Jump to content
  • Advertisement
Sign in to follow this  
HopeDagger

OpenGL Optimizing 2D sprite drawing..

This topic is 4967 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

No no, hold on there. This isn't a "how do i maek opengl 2d?" thread, so put that pitchfork away, and douse that torch. :) For my uses of OpenGL over the past while, I've been primarly focusing on the 3D aspect of the API, so I'm not quite sure of the most efficient way to draw sprites. My first instinct was to place the vertex/texcoord drawing in a display list and use that, but perhaps a vertex array would be faster, if the dynamic data isn't going to cause more slowdown than speed increase. I'd like to hear from anyone who has experimented with this sort of area in OpenGL, and what method you use that you've found to be the quickest. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
If your sprite consists of 2 triangles then putting it into a vertex array wont help, AFAIK there is a setup cost associated with it and with 2 triangles it wont be worth it (Immediate mode would probably be faster).

Depends what you are going to be drawing and how really, if you have a 100 sprites using the same texture then sure throw them into a VA and draw them in one go (or reuse from VBO). If you are drawing a lot of different sprites (again 2 triangles or so) a display list would probably help but not sure how much faster it would be to Immediate mode.

Im not sure what is the fastest, my programming has all been 3D up to now. I just have 2D stuff go through the same 3D pipeline with a different shader that sets ortho mode, its all going in as VAs atm (my 2D drawing is a lot of things of the same texture though).

Interested to hear others experience with this

HTH

Share this post


Link to post
Share on other sites
if its applicable u could use pointsprites.
else each frame find out what sprites are visable, group these by material, copy there vert positions into an array (very quick) and draw it in one go

Share this post


Link to post
Share on other sites
gotta admit, im not a great fan of point sprites.
eg u cant do text etc with them cause they all use texture coordinates 0.0->1.0
so its only really particle systems, but most particle systems eg fire smoke explosion look so much better with a bit of rotation in them that it rules it out for them as well :(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!