OpenGL Enumeration

Started by
10 comments, last by Tealc 21 years, 7 months ago
Hello, I turned from DirectX to OpenGL. With DirectX it was possible to do an enumeration of the available display modes. How can I do this with OpenGL ?? Best Regards, Tealc
Advertisement
You can''t do this with OpenGL. It does only provide the glGetString function which describes either GL_VENDOR, GL_RENDERER, GL_VERSION or GL_EXTENSIONS.

But assuming that you''re working with Windows, the GDI provides the functions you''re looking for:

EnumDisplayDevices
EnumDisplayMonitors
EnumDisplaySettings
You can KIND of do it...check the msdn for a "glEnum" sample project. I found it a few weeks ago, and it basically cycles through all the available pixel formats and acceleration modes...

I can''t remember how the hell to find it through the search though, as "glEnum" didn''t seem to produce anything..

Good luck!
http://download.microsoft.com/download/platformsdk/Other/1.0/WIN98Me/EN-US/Glen.exe

is what above poster is referring to i believe
quote:Original post by Iolo
You can KIND of do it...check the msdn for a "glEnum" sample project. I found it a few weeks ago, and it basically cycles through all the available pixel formats and acceleration modes...

Yes, but remember that OpenGL alone can''t do this. It''s the Win32 API extensions you''re thinking of. On Linux, for example, you''d have to use the related GLX functions to achieve pixel format enumeration. On Windows, you can use DescribePixelFormat for every available pixel format ID (the functions returns the maximum pixel format index if it succeeds) and extract pixel format information out of the PIXELFORMATDESCRIPTOR structure.

But I think that the original poster was more interested in enumerating display modes (like 800x600x16) and not pixel formats. To enumerate display modes, you''ll have to use the GDI function EnumDisplaySettings and extract the desired information out of the returned DEVMODE structure (dmPelsWidth, dmPelsHeight and dmBitsPerPel).
Thanks for the link AP...that''s the one I meant.

Origin - Yeah I guess you''re right. It is a *tad* win32 dependent, and the glEnum sample isn''t quite what the original poster had wanted (I think)..

I guess maybe in a "perfect" system (win32 speaking) you might probably think of doing both: enumerating the available desktop modes, combined with enumerating the pixel formats which support hardware accelerated OpenGL?

sdl anyone?
http://sdldoc.csn.ul.ie/sdllistmodes.php


http://uk.geocities.com/sloppyturds/gotterdammerung.html
Firstly - there is no ''glEnum'' function listed in my help files

There seems to be some ideas of how to get the device information, but how would one go about forcing an OpenGL window to use that device specifically?

Any Ideas?
Light at the end of the tunnel? I can''t even find the tunnel!!
do u have a early voodoo card?
ive never had one so cant help you.

but the information u ask for has nothing to do with opengl, did u check out libsdl? what specific case are u trying to do.

http://uk.geocities.com/sloppyturds/gotterdammerung.html
quote:Original post by Bwuce_Wee
Firstly - there is no ''glEnum'' function listed in my help files

There seems to be some ideas of how to get the device information, but how would one go about forcing an OpenGL window to use that device specifically?

Any Ideas?

What do you mean? You can set the pixel format of a device by calling SetPixelFormat on your device context. OpenGL is forced to use that device context by specifying it when calling wglCreateContext.

If you''re talking about display modes, that''s even easier. Just call ChangeDisplaySettings with the appropriate device mode.

This topic is closed to new replies.

Advertisement