Jump to content
  • Advertisement
Sign in to follow this  
kibokun

OpenGL Avoiding old OpenGL paradigms

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

I'm learning OpenGL for a 2d, cross-platform project and right now I'm using the typical glBegin/.../glEnd system because that's what I've read tutorials for. I've been reading that this is pretty-outdated and I definitely plan to incorporate shaders for full-screen post-processing effects later on, so I'd like to learn the programmable pipeline from the start. What are some of the good tutorials you've found that include source-code to execute? Preferably in C/C++. I'm working with SDL for windowing, but I don't think moving away from the fixed pipeline will change that code at all. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Googling for OpenGL 3.0 Tutorial lands some good results. But basically everything has to be in Vertex Arrays now and support for the fixed function pipeline, i believe is also deprecated.

You can peek at the quick reference card from here:
http://www.khronos.org/files/opengl-quick-reference-card.pdf

You can grab 3.1 specific header files here that will just allow you to keep yourself honest since none of the deprecated function calls are included.
http://www.opengl.org/registry/

-me

Share this post


Link to post
Share on other sites
OpenGL 3.0, 3.1 and 3.2 deprecate a lot, the most annoying for beginners being immediate mode (glBegin/End), the fixed pipeline (everything requires shaders) and the modelview and projection matrix.

The last point is not really essential if you are making a 2D game. If you rescale any point from x: [0, width] and y: [0, height] to x and y: [-1, 1], that should be all the transformation you need.

Not having immediate mode means you need to load your vertex/normal/texcoord data to the videocard in larger chunks using, for instance, a Vertex Buffer Object, as is preferred in OpenGL 3.0 and onwards. OpenGL 3.2 takes this a step further by packing the VBO's inside a Vertex Array Object, but this has no major performance boost as far as I am aware. My point, for performance, use a VBO.

Not having the fixed pipeline means everything needs to be done in shaders. This should be what you want to do anyway, although for most 2D graphics it might feel like overkill. If you don't really need it, write a very simple one anyway. The simpler, the faster the rendering.

The nice thing about OpenGL 3.x is that VBO's and shaders are moved to the core, but they are available using 2.x as well, if the card supports the extensions.

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!