OpenGL version

hi,

sorry to ask such a stupid question, but I would like to remove some doubts in my mind.

glGetString (GL_VERSION);

Should the result depends on how we created the context ? Or should the return be what the card/driver officially supports ?

Thanks.

Should the result depends on how we created the context ? Or should the return be what the card/driver officially supports ?

What do you mean by “officially supports”?

If you use the standard context creation method (ie: you’re not using WGL/GLX_ARB_create_context), then the OpenGL implementation can give you 2.1 or any OpenGL version that is fully backwards compatible with that. So you could get 3.3 with the compatibility profile.

If you use the new context creation method, then the OpenGL implementation will give you the version you ask for, or any higher GL version that is fully backwards compatible with what you asked for. If you ask for 3.2 core profile, you could get 3.3 or 4.1 core profile.

Really, what does it matter what is “officially supported”?

I see.

Under Linux I can have OpenGL 3.1 with “standard” context creation. Under Windows, I’m stuck with OpenGL 2.1 (from what GetString returns to me). So, reading from here and there, I realized I need to create a standard context, then create a context with the new way.

So, from the first context is created (within standard method), GetString returns only what the context allows you to do with GL (ie 2.1). And we need to test any context creation (ie 4.1, then 4.0, then 3.1…) until we find an accepted one (for the new way to create contexts).

Maybe it’s the better way to do. But aren’t there any ways that could allow us to know which context should we ask for directly, I mean, without having to guess all ?

thanks for your care.

Under Linux I can have OpenGL 3.1 with “standard” context creation. Under Windows, I’m stuck with OpenGL 2.1 (from what GetString returns to me).

Are you sure your drivers are up-to-date? What hardware are you using?

But aren’t there any ways that could allow us to know which context should we ask for directly, I mean, without having to guess all ?

Whichever one your code is written for.

If you’re writing code that works for 3.3 core profile, then you should ask for 3.3 core profile. If you’re writing code that only works for 4.1 core profile, then you should ask for 4.1 core profile.

It’s all about what you intend to support.

Now, if you intend to support multiple code paths based on multiple different versions, then you have to loop over the versions. But even then, it’s only the versions you intend to support.

Yes they are (I use ati mobility radeon HD 4570). I have GL 3.1 from GetString when I use the new context creation (and only 2.1 when I use the standard creation method). At least the begining, since the following of the program fails for now.

Thanks.

Sorry Alfonse, but I do not completely agree with you.
Actually old context creation mechanism does return the highest supported OpenGL version but only if at least GL 3.2 is supported as that version introduced the profile mechanism, I don’t think that it would work with GL 3.0 or 3.1.

arts: you should update your drivers as I think even the mobility version of the radeon HD 4570 should support GL 3.3 with latest drivers.

So to sum up, AFAIK, you get the following highest versions with old/new context creation:

GL 3.0 driver - old context creation -> version 2.1
GL 3.0 driver - new context creation -> version 3.0
GL 3.1 driver - old context creation -> version 2.1
GL 3.1 driver - new context creation -> version 3.1 (and if you have the GL_ARB_compatibility extension then you have deprecated stuff also)
GL 3.2+ driver - old context creation -> version 3.2+ compatibility profile (with deprecated stuff included)
GL 3.2+ driver - new context creation -> version 3.2+ core/compatibility profile (whatever you ask for)

Actually old context creation mechanism does return the highest supported OpenGL version but only if at least GL 3.2 is supported as that version introduced the profile mechanism, I don’t think that it would work with GL 3.0 or 3.1.

Well technically yes, but outside of out-of-date drivers (as in this case), you won’t see 3.0 or 3.1 in the wild. All 3.x hardware supports exposes 3.3 now.

you should update your drivers as I think even the mobility version of the radeon HD 4570 should support GL 3.3 with latest drivers.

FYI, my HD 3300 supports 3.3 too, so your 4570 should be fine. Updating your drivers may be a problem, due to issues with driver updates on laptops.

From what aqnuep says, it seems I don’t have any driver issues at all. I have version 2.1 when using old context creation and I have 3.1 when I use new context creation (even if under Linux I already have 3.1, but maybe I use glX functions that allow me this)

And from what said in this topic, I deduce that glGetString returns the version regarding how we create the context. And it seems it’s not possible to know what max OpenGL version is supported but with making context creation tries in the row, from the latest to the oldest we’d like to support.
Maybe by getting the renderer from glGetString, but since there are so many different kind of graphic card, guessing by trying different context seems the best solution.

PS: If you really think I have a driver issue, I think now I’m a bit lost, so please explain me why.

Thanks

From what aqnuep says, it seems I don’t have any driver issues at all.

Except for the fact that your card is perfectly capable of 3.3, but you’re only getting 3.1. You still need to update your drivers.

Ok, thank you Alfonse Reinheart. I’ll have a look at it (and it seems 3.3 is only available for linux for now since I really have latest ati drivers under linux).

A question rose in my mind.

Is it allowed, recommanded to use the new context creation for asking for GL 2.x capabilities only ? Or should I avoid doing so ?

I tried it and worked, but I’d like to know what people here are thinking about it.

Thanks in advance.