opengl 2.0 - beginner

I was planning to start using opengl2.0.
Sorry for the odd-lame question: is there supposed to be any kind of new inclde header file like gl.h in which all the new functions that are included in the standard are specified?

What are the basic includes you need to program with opengl2.0?

Phoenix,
You need glext.h

You can get the latest revision from
http://oss.sgi.com/projects/ogl-sample/sdk.html

ok, thanks for the answer…another little question: so what’s the difference between programming with extensions and programming with standard OpenGL 2.0?
Does it mean only that I will use extensions that have been approved as a standard (plus of course the glsl langauge)?

In that case, what do you use to handle extensions? I’ve heard about glew (http://glew.sourceforge.net/)
Do I actually need it?

Thanks again.

…sorry again, I also guess that if the issue is just about using extension I guess there is no official equivalent of the red-book explaining all the opengl2.0.

Do I have just to get the orange book (for glsl) and the extension specifics?

AFAIK, GLSL is standardized in v2.0, which means “ARB” suffix is removed from function name.
Migration Guide from 1.5 to 2.0

Other extentions are still remain in same way. For example, VBO is still ARB extension.

glee or glew may help you to use OpenGL extensions in your programs, but you don’t have to use. Personally, I don’t use them. In Linux, the OpenGL driver is up-to-date, so you can just use new GL functions in normal way. You do not need to get function pointer in runtime. (with GetProcAddress stuff)

There is new red book came out (5th edition), but I don’t know how much it covers v2.0.

I usually read extension specifications. They are really damn good! Here is an example:
VBO
==song==

ok, thanks for the answer…another little question: so what’s the difference between programming with extensions and programming with standard OpenGL 2.0?
An extension means it’s not in the core.
When an extension is voted to go into the core, either no change is made, or there is a small change in the specification.
Of course, the suffix is dropped, but I don’t count this as a change.

GL 2.0 adds the following features to the previous core, which was GL 1.5
http://www.opengl.org/documentation/opengl_current_version.html

In that case, what do you use to handle extensions? I’ve heard about glew (http://glew.sourceforge.net/)
Do I actually need it?
I think you are confused. Glew gets GL function pointers for you because opengl32.dll and opengl32.lib is only 1.1

It gets core function pointers and extension function pointers.

Do I have just to get the orange book (for glsl) and the extension specifics?
The orange book discusses the high level shader feature of GL 2.0
It’s called the OpenGL Shading Language or GLSL

Hope that helps

well, thanks a lot…Now everything is clear.
I think I got a bit confused because I was just not expecting the new 2.0 core features to be found in the glext.h

Originally posted by songho:
[b]

Other extentions are still remain in same way. For example, VBO is still ARB extension.

[/b]
VBO was made core in 1.5

Originally posted by songho:

glee or glew may help you to use OpenGL extensions in your programs, but you don’t have to use. Personally, I don’t use them. In Linux, the OpenGL driver is up-to-date, so you can just use new GL functions in normal way. You do not need to get function pointer in runtime. (with GetProcAddress stuff)

Humm, good luck in writing portable applications then. The Linux ABI only specifies that OpenGL1.2 binary interface has to be specified. So if you just link against other functions, your app may barf saying “entry point not found” on other drivers/cards.
http://oss.sgi.com/projects/ogl-sample/ABI/

Originally posted by songho:

There is new red book came out (5th edition), but I don’t know how much it covers v2.0.

The new red book does cover OpenGL 2.0

VBO was made core in 1.5
True, But my point was using GLSL without ARB suffix in v2.0 and VBO is still with ARB suffix in v2.0.

Actually vertex/fragment programs and shader object are introduced in v1.5 as ARB extension. Please read the link in the previous post.

Humm, good luck in writing portable applications then. The Linux ABI only specifies that OpenGL1.2 binary interface has to be specified. So if you just link against other functions, your app may barf saying “entry point not found” on other drivers/cards.
What I said was that glee, glew or similar exension helpers are not mandatory to access extensions. I do not depend on those exension helpers. I use own routine to use extensions safely in similar manner.

For Windows, the function pointer must be get from ICD driver. But the story is a little different for Linux: once extension found with glGetString(GL_EXTENSIONS), you can safely use the associated functions without glXGetProcAddress() or glXGetProcAddressARB().

Here is an example, the default Mesa driver with DRI supports upto v1.4 for my old Radeon 7200 with hardware acceleration (Yes, I don’t need function pointers). I can also run a VBO program with it. If you use vendor specific driver, you don’t need to get pointers to the functions, either. nVidia and ATI drivers support v2.0 now for Linux.

Please read the recent thread related with this:
linux gl compile errors

The new red book does cover OpenGL 2.0
I said I don’t know how much it covers v2.0. Buy the book before me (or if you have one already) and let me know it is worth to have. :wink:
I have only 3rd edition of red book and the orange book.

Regards.
==song==

Originally posted by songho:
[quote]VBO was made core in 1.5
True, But my point was using GLSL without ARB suffix in v2.0 and VBO is still with ARB suffix in v2.0.
[/QUOTE]Uh, no. When something is made core it loses ALL suffixes. VBO was made core in OpenGL 1.5 and lost all the suffixes in the process. Download the OpenGL specs on the main page and look for “BindBuffer”.

Originally posted by songho:

Actually vertex/fragment programs and shader object are introduced in v1.5 as ARB extension. Please read the link in the previous post.

When OpenGL 1.5 was released, shader objects did not exist. They were added later. That guide is for people migrating from using the shader object extenion to using core functions. (as it is slightly different)

Originally posted by songho:

What I said was that glee, glew or similar exension helpers are not mandatory to access extensions. I do not depend on those exension helpers. I use own routine to use extensions safely in similar manner.

My point was it may work for you, but it is not user/portable friendly. If say you use say a OpenGl 2.0 function (without loading it manually) and give your program to someone who does not have a OpenGL 2.0 driver, your app will probably not event run (dynamic linker error?). (eg. so you can’t easily do fallbacks for older cards etc) It is much cleaner to load the functions you need once you know the functionality is supported. This way you can write fallbacks or tell the user a better graphics card is needed.

Originally posted by songho:
[b]

[quote]The new red book does cover OpenGL 2.0
I said I don’t know how much it covers v2.0. Buy the book before me (or if you have one already) and let me know it is worth to have. :wink:
I have only 3rd edition of red book and the orange book.

Regards.
==song==[/b][/QUOTE]I already have the book. It has smatterings of updates through-out the book about OpenGL 2.0 and a seperate section on it at the end. (to do with shaders etc)

I personally don’t use the red books much as I prefer the blue books. (I usually know what I want to do, just need to know want side-effects of certain functions are)

well, my aim is also to write portable applications, so, as far as I understood, I guess it could be wise to use glew as well.

Basically I will have to test easily whether some extensions are available, and in case load them and use them (in a “portable way”).

Phoenix, No one is suggesting that you need glew or glee to write portable code–those libraries simply make the task easier in many cases, at the cost of an additional dependency.

I find the extension loading process to be a trivial affair, and I dislike dependencies (where they can be avoided), so I do it manually.

At any rate, you should probably be familiar with how to do this, even if you do end up using a helper. Here’s an overview:
http://www.opengl.org/resources/features/OGLextensions/

Cheers,

:slight_smile:

Originally posted by Phoenix:
well, thanks a lot…Now everything is clear.
I think I got a bit confused because I was just not expecting the new 2.0 core features to be found in the glext.h

They could have updated gl.h, but since they started with glext.h, it continues that way and will in the future.

All you need to do is

#include <GL/gl.h>
#include <GL/glext.h>

or if you use Glew

#include <GL/glew.h>
#include <GL/gl.h> //Perhaps you don’t need this
#include <GL/glext.h> //Perhaps you don’t need this

When you run your program, check the GL version.
I have my own lib to help me out with things like this

http://www.geocities.com/vmelkon/glhlibrary.html

GLfloat glhGetOpenGLMainVersion();
GLfloat glhGetGLSLMainVersion();
void glhGetOpenGLMainVersionAsString(char *buffer);
void glhGetGLSLMainVersionAsString(char *buffer);

You don’t have to use it just like you don’t have to use Glew

Originally posted by sqrt[-1]:
[b] [quote]Originally posted by songho:

[quote]VBO was made core in 1.5
True, But my point was using GLSL without ARB suffix in v2.0 and VBO is still with ARB suffix in v2.0.
[/b][/QUOTE]Uh, no. When something is made core it loses ALL suffixes. VBO was made core in OpenGL 1.5 and lost all the suffixes in the process. Download the OpenGL specs on the main page and look for “BindBuffer”.
[/QUOTE]I looked at glext.h again, and you are right, sqrt[-1].
I can also get the functon pointers for VBO without the ARB affix (if v1.5 or higher is supported), for example, glBindBuffer().

Sorry guys, please ignore my previous incorrect info. I made bad guess because I had troubles to get ARB the function pointers of GLSL with v2.0 driver.

And, I think that using or not using glew/glee is a bit sensitive issue, so I do not want to discuss it any more.
Regards.
==song==