New to OpenGL and deprecation [closed]
Asked Answered
D

3

5

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?

Douzepers answered 16/1, 2010 at 21:58 Comment(4)
Not an example, but this forum post has a little bit of "help, I can't draw anything!" kind of help: opengl.org/discussion_boards/…Direction
Although if you're new to OpenGL entirely, I would seriously recommend learning the OpenGL 2 style first (plenty of tutorials on that). 2.x is much more straightforward for beginners, and it's not so hard to switch to 3.x later.Direction
I consider starting with OpenGL 2.x dangerous. There are a lot of ways to accomplish things in 2.x, and there's quite a chance that you start learning those which are deprecated in 3.x.Debbiedebbra
I agree with Malte. While the fixed functionality pipeline may be easier for beginners, it will just make it harder to relearn the right way.Asthenia
M
2

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.

Mages answered 17/1, 2010 at 7:38 Comment(5)
minor nit-pick. GL3 is very similar to GL ES 2.0. ES 2.0 was the first to be specified, after all.Purulent
@Purulent I don't know why similarity should be chronological. Isn't it a symmetric property?Counterstamp
I'd rather not suggest to learn desktop GL through GLES, as this introduces much more problems. @OP Look at tomriddle's answer if you're still interested and haven't yet made the mistake to buy a book on an API you're not going to use.Counterstamp
@Christian: true. What I interpreted (chronological order) isn't actually in the text... My bad. As to "made the mistake", in this context - GLES2.0 being a subset of GL3-, maybe you could explain why it'd be a mistake ? I'm not sure I see it yet. (not in comments though?)Purulent
@Purulent Except for the things that are missing from ES 2, which are many important ones, there is not that much of a difference, maybe some precision modifiers or something. It's just not appropriate as sooner or later you try to port applications and have to change some things or you look at desktop GL code and wonder what they're doing. Though it's maybe worse to learn ES through desktop GL than the other way around. But buying a book is a step too heavy when you really want something different, as there is enough material out there that teaches the right direction.Counterstamp
M
3

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/

Merbromin answered 5/10, 2011 at 12:21 Comment(1)
The links are dead.Dardan
M
2

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.

Mages answered 17/1, 2010 at 7:38 Comment(5)
minor nit-pick. GL3 is very similar to GL ES 2.0. ES 2.0 was the first to be specified, after all.Purulent
@Purulent I don't know why similarity should be chronological. Isn't it a symmetric property?Counterstamp
I'd rather not suggest to learn desktop GL through GLES, as this introduces much more problems. @OP Look at tomriddle's answer if you're still interested and haven't yet made the mistake to buy a book on an API you're not going to use.Counterstamp
@Christian: true. What I interpreted (chronological order) isn't actually in the text... My bad. As to "made the mistake", in this context - GLES2.0 being a subset of GL3-, maybe you could explain why it'd be a mistake ? I'm not sure I see it yet. (not in comments though?)Purulent
@Purulent Except for the things that are missing from ES 2, which are many important ones, there is not that much of a difference, maybe some precision modifiers or something. It's just not appropriate as sooner or later you try to port applications and have to change some things or you look at desktop GL code and wonder what they're doing. Though it's maybe worse to learn ES through desktop GL than the other way around. But buying a book is a step too heavy when you really want something different, as there is enough material out there that teaches the right direction.Counterstamp
S
2

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.

Symmetry answered 5/10, 2011 at 13:4 Comment(1)
Whereas this is a rather good idea, it is more of a training excercise once he has found some learning resources and therefore doesn't really answer the question.Counterstamp

© 2022 - 2024 — McMap. All rights reserved.