Creating Optimal OpenGL Window

Are there any rules for creating an optimal window for OpenGL? Specifically with ChangeDisplaySettings and SetPixelFormat? So if I tested and found my display was using 24 bit colour should I try to switch it to 16 bit or 32 bit colour?

I also noticed that when I enable the depth buffer my framerate drops to half. I was wondering if I was ending up in some software only mode. If that is the case, what can I do to detect which modes are better than which on any computer and choose that best mode?

I’m using VC 6 (no MFC, no GLUT) and I don’t want to change that for now.

Originally posted by Furrage:
Are there any rules for creating an optimal window for OpenGL? Specifically with ChangeDisplaySettings and SetPixelFormat? So if I tested and found my display was using 24 bit colour should I try to switch it to 16 bit or 32 bit colour?

Try to match display color depth and rendering depth.
IE 16bit displaymode -> 16bit pixelformat w 16bit z, if required; 32 bit display ->32bit pixelformat w 32bit z.
Now, if you really have a 24bit display, go for a 32bit pixelformat. If you can get a genuine 24bit pixelformat, you might as well go for it, but I doubt it. That’s very uncommon, I believe Matrox was one of the few chip vendors with that option.

I also noticed that when I enable the depth buffer my framerate drops to half. I was wondering if I was ending up in some software only mode. If that is the case, what can I do to detect which modes are better than which on any computer and choose that best mode?

What kind of scene was that?
If you tested that just with an (almost) empty screen, that’s exactly what you should expect. After all, the card has to move twice the amount of data.

If you hit a software path, performance usually drops drop a lot more.

perhaps leave the window creation up to something like sdl?

I tested a Sis6326 and a Sis597/598 and got the following results
Device Mode Information (using EnumDisplaySettings)

Device mode	 dmBitsPerPel	 dmPelsWidth	 dmPelsHeight	dmDisplayFlags	 dmDisplayFrequency
0	4	640	480	0	0
1	8	640	480	0	0
2	8	800	600	0	0
3	8	1024	768	0	0
4	16	640	480	0	0
5	16	800	600	0	0
6	16	1024	768	0	0
7	24	640	480	0	0
8	24	800	600	0	0
9	24	1024	768	0	0
10	24	1024	768	0	0

Pixel formats that support OpenGL and double buffering (using DescribePixelFormat)

Pixel format	 dwFlags	 iPixelType	 cColorBits	 cAlphaBits	 cAccumBits	 cDepthBits	 cStencilBits	 cAuxBuffers
3	 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER	PFD_TYPE_RGBA	24	0	64	32	8	0
4	 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER	PFD_TYPE_RGBA	24	0	64	16	8	0
7	 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER	PFD_TYPE_COLORINDEX 	24	0	0	32	8	0
8	 PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER	PFD_TYPE_COLORINDEX 	24	0	0	16	8	0

What should I do in these cases. Also It says no Alpha. Does that mean I will not be able to show transparent objects?

[Edit]How do I avoid/minimise software paths (I know these cards are not fully OpenGL compliant). And if I wanted the fastest rendering/texturing do I have to use trial and error or are there some guidelines for this. Assume I’ve already taken care of LOD, BSP Trees and other stuff that is not OpenGL specific. I’m more concerned about Device Mode, Pixel Format, and stuff to glEnable/glDisable. Face culling doesn’t count here cause I am only experimenting with three Quads.

[This message has been edited by Furrage (edited 04-15-2002).]

>>Also It says no Alpha. Does that mean I will not be able to show transparent objects?<<

thats destination alpha, u can still do blending/alpha test as long as the blending methods aint dest_alpha or 1-minus_dst_alpha

>>How do I avoid/minimise software paths (I know these cards are not fully OpenGL compliant)<<

Sis use the same data formats/methods as quake3

Originally posted by zed:
Sis use the same data formats/methods as quake3

I know nothing about quake 3’s data formats and methods. Could you enlighten me or direct me to a site?

http://www.quake3arena.com/news/glopt.html

btw check first to see if quake3 does run at a reasonable speed on your machine first, if it doesnt get the latest drivers from sis + if that doesnt help perhaps u cant get opengl hardware acceleration

Thanks. I’ll try some of the optimisations and see what happens.