Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New to OpenGL and deprecation [closed]

I've begun playing around with OpenGL in Python using PyOpenGL 3.0.1b.

I looked at some sample code and started running it and modifying it etc. All was well until I became a little less ignorant.

On http://pyopengl.sourceforge.net/documentation/manual-3.0/index.xhtml the OpenGL functions are listed as well as whether or not they are deprecated. So I thought to myself I'll just have to find some up to date tutorials that don't use all this deprecated crap.

Hours later, no such luck! Deprecated sample code after deprecated sample code... is there somewhere I can go for non-deprecated tutorials?

like image 720
Derek Litz Avatar asked Jan 16 '10 21:01

Derek Litz


3 Answers

Thanks to Jason L. McKesson

No deprecated code fantastic examples and tutorials here (in OpenGL 3.3)

http://www.arcsynthesis.org/gltut/index.html

And another one without too much explanation here (in OpenGL 4.x and 3.3)

http://openglbook.com/the-book/

like image 168
tomriddle_1234 Avatar answered Oct 17 '22 18:10

tomriddle_1234


OpenGL ES 2.0 is in fact very similar to OpenGL 3, with some functionality removed (such as Multiple Render Targets, some shader instructions, etc). OpenGL ES 2.0 Programming Guide book has some tutorials and source codes available for download, which can help you get started with OpenGL 3.0 . What compiles in ES 2.0 will also compile for newer OpenGL specifications, mostly. You can search for ES 2.0 tutorials online, as well.

I would also recommend checking out the graphics engine I am developing ( OpenREng ). You can check out OpenGL wrapper classes to see most of the functionality supported in newer specifications.

like image 2
AdilYalcin Avatar answered Oct 17 '22 17:10

AdilYalcin


The way I recommend learning is to take a fixed function program and slowly begin turning it into a core profile one by adding each bit at a time. There are basically 3 major things you need to tackle and unfortunately there all fairly big and tie in to each other in such a way that if you don't get anything on the screen you have no idea which bit is broken. But if you can go about it the correct way you should be fine.

Firstly learn Vertex Buffer Objects and Vertex Array Object. To ditch glBegin, glEnd, glVertex3f, glColor4f, glNormal3f, glTexCoord2f, etc...

Learn manual matrix transformations to ditch glRotatef, glTranslate, glPushMatrix, glPopMatrix, glMatrixMode, glLoadIdentity, GL_PROJECTION, GL_MODELVIEW, glFrustum, glOrtho, gluLookAt, gluPerspective, gluOrtho2. I recommend looking at glm which is the one the OpenGL site mentions in their SDK. While you are still using the fixed function components on the non-core profile you can manually load the matrix with glLoadMatrixf, later you will need to bind the matrices to the shaders.

Learn basic GLSL shaders. There are deprecated gl_vertex, gl_normal, ftransform() that should still work with VBO's, you can use them until you have the shader bindings fully setup.

Then do all the shader binding, use vertex attributes instead of the fixed gl_vertex and gl_position. Use uniform's to upload the modelview, and projection matrices rather the ftransform(). and things like lights and material properties (I tend to upload the modelviewprojection instead of just the projection so the shader isn't calculating that each time).

Finally use a core profile, you will need a windowing toolkit that supports creating one. GLUT, GLFW do. SMFL doesn't. SDL 1.3-dev does. I don't think pygame does unfortunately. The core profile will ditch any deprecated functionality that was left lying around.

like image 2
David C. Bishop Avatar answered Oct 17 '22 18:10

David C. Bishop