PDA

View Full Version : Converting from OpenGL version 2.1 to version 3.0 and above



peterkl
08-02-2015, 11:23 AM
I have a simple Go program, my first program in OpenGL. It uses OpenGL version 2.1:

https://github.com/pebbe/gl/blob/master/gl2.1/demo.go

I rewrote it for OpenGL version 3.0 and above. It's much less simple now:

https://github.com/pebbe/gl/blob/master/gl3/demo.go

Would someone please take a look if there are still things in there that are not allowed in new versions of OpenGL?

Is glLineWidth() still allowed?

By the way, how do you exactly set the line width? glLineWidth(5) seems to have the same effect as glLineWidth(50).

GClements
08-02-2015, 12:35 PM
Would someone please take a look if there are still things in there that are not allowed in new versions of OpenGL?

The easiest way to check what's allowed is to check the reference pages for OpenGL 3 (https://www.opengl.org/sdk/docs/man3/) or OpenGL 4 (https://www.opengl.org/sdk/docs/man4/). They only list the functions which are available in the core profile. The OpenGL 2 (https://www.opengl.org/sdk/docs/man2/) reference pages document legacy functions.



Is glLineWidth() still allowed?

It is.


By the way, how do you exactly set the line width? glLineWidth(5) seems to have the same effect as glLineWidth(50).
There are implementation-defined limits to the maximum line width. Use glGet(GL_ALIASED_LINE_WIDTH_RANGE) to determine the minimum and maximum widths for non-antialiased lines and glGet(GL_SMOOTH_LINE_WIDTH_RANGE) for anti-aliased lines.