Results 1 to 10 of 179

Thread: nxPascal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    Lots of the above code is changed now... I removed ambient color because it didn't feel necessary/useful for 2D, and also moved the color multiplication from fragment to vertex shader for more performance. All in all the rendering queue technique really works, and it's automatically switching the shader program, although i haven't done hard stress tests yet. I have uploaded the recent changes to SVN, where is Draw() and DrawRotateS() implementation for now.

    I did my best to make the coding as easy as possible, while also not doing anything unnecessary work in the functions for that. So attached outcome can be gotten with 3 lines of code:
    Code:
      // Draw a quad at (50, 200), pattern 0, facing angle from point to cursor, centered at (0.2, 0.5), with scale 64, 64
      index:=renderer.DrawRotateS(50, 200, 0, angle(vector2f(50, 200), playerPos), 0.2, 0.5, 64, 64);
      // Returned index is first vertex index for the GL_QUAD. Change that to red. Last vertex would be index+3
      renderer.SetColor(index, 1, 0, 0, 1);
      // Finally flush the rendering buffer. You can queue up more Draw commands before rendering them.
      // If buffer would get full, it will render them automatically, and start the buffer from 0 again.
      renderer.Render;
    Also i have very strong doubt that the shader queue rendering is much much faster than my previous DrawRotateS() without it. This time the rotation is also done with efficient math, not using glRotate matrix operations.
    Attached Images Attached Images
    Last edited by User137; 08-04-2013 at 09:37 AM.

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
  •