Page 1 of 3 123 LastLast
Results 1 to 10 of 179

Thread: nxPascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Added all file links again, this time i also added compiled demos, they include media files needed to run them. Both Lazarus and Delphi versions for source code.

    Latest addition is framebuffer class of which 1 demo is about. A rotating cube which faces are showing the same screen of rotating cube which faces contain rotating cubes and... lol

    What else.. hmm i forgot to make a demo about nxSound, but you can see brief example in above message, it is at that simple level.

    The future:
    - Researching more on OBJ file format i discovered that it not only supports triangles but loading must also be able to use polygons. This was a setback to my 3D model code which i have to reorganize fundamentally. Something along the lines of TPolyModel and TTriModel would be still for triangles only. For gaming use, vertexarrays etc all must be triangles. Internal code will convert polygon models into triangle models and use normal generation where needed.
    (Knowing that i updated my old 3D editor for being able to load all OBJ models now, just nxEngine itself can't yet.)
    - UIEditor: I still have plans to make the component editing more like designing forms is in Delphi. Meaning you could select many items, drag them or change multiple properties at the time. I'm also not pleased with the layout.
    (- Possibly article of making simple program or game... make you know more about the engine )

    edit: I still don't know how i'd add musics. Looked into OpenAL playing but didn't get anything working. Tips?
    Last edited by User137; 05-08-2011 at 07:02 PM.

  2. #2
    Quote Originally Posted by User137 View Post
    edit: I still don't know how i'd add musics. Looked into OpenAL playing but didn't get anything working. Tips?
    OpenAL was designed to work with raw sound files like WAV. It doesn't have support for music files like MP3 or OGG. We should code the player... Fortunately Ivo Steinmann did this work for us. The project Mundo uses it. There is two units, ogg.pas and vorbis.pas, you can find it at http://gamemundo.svn.sourceforge.net...nk/src/client/

  3. #3

    How to show image with fade-in and fade-out effect?

    Can you tell me how to show fade-in and fade-out effect with nxPascal?

  4. #4
    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.

  5. #5
    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;

  6. #6
    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.

  7. #7
    FrameBuffer in src_demos/delphi_demos reports an AV exception.

  8. #8
    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)

  9. #9
    I just got a weird theory to optimize texture memory... There are times when you just need textures that are not power of 2, for example odd 300x200 image. nxPascal can currently load that as either scaled to nearby size (256x256 in this case) or pixel-perfectly unaltered but fit in 512x256 "frame". However the "frame" will in this case waste alot of unused memory.

    What i came up with (as just idea so far), is that i'd have 2 integer (word) variables per texture: XPart, YPart. The loader would calculate perfect fit for image that is divided in 1, 2 or 4 subtextures. That 300x200 would be divided in 2 parts to make as whole a 320x256 "frame", because the height cannot be split in 2:
    256x256, 64x256

    If i count memory saving for RGBA image:
    300x200 originally as 512x256 "frame" needs 524288 bytes.
    2 subtextures need 262144 + 65536 = 327680 bytes
    which is 62.5% of memory that would normally be reserved.

    Obviously this will need draw functions to adapt to subtextures but it shouldn't be problem. 3D model surface would be unable to use this well, but models should always use the scaling option anyway for repeatability.
    Edit: Actually it is big problem if want to support patterned drawing... I'd propably disable/ignore patterns when this is used.

    Also, i just got BASS musics working with Lazarus so that's what i'll be using. Need to make a class wrapper to it to ease the procedural DLL header unit.
    Last edited by User137; 13-10-2011 at 04:57 PM.

  10. #10
    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.

Page 1 of 3 123 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
  •