Jump to content
  • Advertisement
Sign in to follow this  
EvilNando

Basic sprite class

This topic is 2597 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

Im currently gathering info on how to create a 2d renderer in OGL

what has caught my attention is the way these guys are rendering their stuff


basically what everyone is doing is creating the required vertices for each quad every single render frame

something like this



glBegin(GL_QUADS); // Draw sprite
glTexCoord2f(0.0f,0.0f); glVertex3i(-tX, tY,zPos);
glTexCoord2f(0.0f,1.0f); glVertex3i(-tX,-tY,zPos);
glTexCoord2f(1.0f,1.0f); glVertex3i( tX,-tY,zPos);
glTexCoord2f(1.0f,0.0f); glVertex3i( tX, tY,zPos);
glEnd();



Is this a proper solution? Im concerned for performance issues specially if I port this code to embedded systems


would not be better to just have this data created at constructor time? then use transformations as needed (translation, rotation, scale)

Sorry if im not making any sense this is my first time getting into low level API's

Share this post


Link to post
Share on other sites
Advertisement
If using Buffer Objects, sure u should pre-calculate as much of the static 2D stuff. Try also to put as most geometry data in a single buffer and use Texture Atlases.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!