Page 2 of 18 FirstFirst 123412 ... LastLast
Results 11 to 20 of 179

Thread: nxPascal

  1. #11
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Hay all nxPascal contributors, a new post slipped the mod net while I was away... See above.

    Quote Originally Posted by cst_zf View Post
    Can you tell me how to show fade-in and fade-out effect with nxPascal?
    Cheers.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #12
    What is mod net?

    For the problem there is many ways, but by fading you propably mean fading whole screen to black and back in to new screen.

    In 2D mode you can accurately draw a faded black rectangle on top of other graphics, or you can use black glClearColor (is default) and change alpha color of all your graphics. Also to draw rect in solid color you need to disable texture.
    Code:
    tex.Disable;
      nx.Enable2D;
      nx.SetColor(0,0,0,fade);
      nx.RectT(0,0,nx.Width,nx.Height);
      nx.Disable2D;
      tex.Enable;

  3. #13
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Quote Originally Posted by User137 View Post
    What is mod net?
    Simply the net in which I catch spam and other nasties and approve posts from new users. Its the reason why you see a nice clean PGD that's viagra add free and clutter free from spam - there can be anywhere from 5-50 posts to delete per day.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  4. #14
    Quote Originally Posted by User137 View Post
    What is mod net?

    For the problem there is many ways, but by fading you propably mean fading whole screen to black and back in to new screen.

    In 2D mode you can accurately draw a faded black rectangle on top of other graphics, or you can use black glClearColor (is default) and change alpha color of all your graphics. Also to draw rect in solid color you need to disable texture.
    Code:
    tex.Disable;
      nx.Enable2D;
      nx.SetColor(0,0,0,fade);
      nx.RectT(0,0,nx.Width,nx.Height);
      nx.Disable2D;
      tex.Enable;
    I means fading-out rendering a graphics with alpha value from 1.0 to 0.0 gradually and fading-in from 0.0 to 1.0.
    That is a useful effect in some situations.

    in this question, i need a procedure like DrawAlpha(left, top, width, height, alphavalue)

  5. #15
    FrameBuffer in src_demos/delphi_demos reports an AV exception.

  6. #16
    Quote Originally Posted by cst_zf View Post
    FrameBuffer in src_demos/delphi_demos reports an AV exception.
    Sorry i can't reproduce the AV with Delphi 7. However nxGL is not catching OpenGL errors for unsupported video cards/drivers at the moment.

    New addition to nxPascal and updated source download link. This is what i mentioned earlier, what i now call TQuadTexture. By adding nxGLExtra in uses-list lets you use memory optimized textures with rotation and scaling. TQuadTexture uses TGLTextureSet for holding 1-4 textures that are fitted for odd and any texture size, like 260x550 would define 4 power of 2 textures and use memory of 260x576 pixels (256+4 x 512+64).

    Normally using GL_NEAREST has no issues with scaling, but with linear filtering there is TDX-feature in use by default that makes visible line-errors between textures disappear.

    To use, simply have variable qt: TQuadTexture; somewhere, and
    Code:
    qt:=TQuadTexture.Create('test.png', true); // Loads with transparency on
    ..
    nx.SetColor(1,1,1); // Use white color
    qt.Draw(0, 0); // Simple draw in point (0,0). Textures are set automatically.
    Last edited by User137; 13-10-2011 at 08:07 AM.

  7. #17
    Decided to make another video. Combination of various features, first off background is 800x600 QuadTexture. Followed by 2 particle launchers at bottom corner, from which right side is a clone of left one. Mouse cursor drops snowflakes which have gravity applied to them. Then there are 3 trail effects also part of particle engine.

    Top top it off, all of that is drawn only in framebuffer. There is a 50x50 grid of indexed GL_QUADS vertexarray, which acts as screen. This let me do a "collapse" effect at where blue trail is moving, basically the grid bends towards it like spacetime

    Background music comes also from the application, by nxBass unit, that is some of BASS library simplified to OOP way of programming.
    This is all there is to it in main program, and it can handle alot of formats:
    Code:
      bassSound:=TBassEngine.Create(handle);
      if not bassSound.CheckErrors then begin
        bassSound.Add('music','data'+PathChar+'test.s3m').  Play;
      end;


    Wireframe option is added to render settings. Unfortunately i can't upload engine sources yet because this broke my model demo that used placeholder particletype. 3D particle rendering isn't ready yet. But adding me to MSN or asking with private message always works and i can send anything.

    Compiled demo added to attachments, let me know if there are any problems running it
    Attached Files Attached Files
    Last edited by User137; 15-10-2011 at 09:09 PM.

  8. #18
    Works flawless here. > 120 FPS on my 8600GT. Good job on this one.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  9. #19
    That seems hard-limited maybe, vsync? Mine is not forced on in driver settings. It actually has no FPS limiter, not even sleep(1), so its giving me 1500-2200 FPS.
    Forgot to mention, the grid is toggled with spacebar key.

    Also i will include this demo in the nxPascal demos sometime soon, need convert the Delphi version aswell.

  10. #20
    Seems very likely that my drivers use v-sync then. It's pretty stable around 120 FPS.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Page 2 of 18 FirstFirst 123412 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •