Advertisement

Cleaning up a bit of the base code.

Started by February 17, 2005 12:49 AM
1 comment, last by James Trotter 20 years ago
This is just to maintain readability, and to take out some legacy things nehe includes. The following states that iLayerType is ignored and was used in previous versions. So if you want pass 0 or NULL instead of PFD_MAIN_PLANE. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_73jm.asp A quicker way to declare the PIXELFORMATDESCRIPTOR is to set the memory to zero then only define the appropriate attributes. Example

PIXELFORMATDESCRIPTOR pfd;
	
	ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR)); // No Gaurentee The memory off the stack is clear so we set all bits to 0
	
	pfd.nVersion = 1;
	pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
	pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;
	pfd.iPixelType = PFD_TYPE_RGBA; 
	pfd.cColorBits = 24; // Colorbits excluding alphabits. Can be 32 if you wish
	pfd.cAlphaBits = 16; 
	pfd.cDepthBits = 32;

And that is a simple replacement to declaring the PFD. Doesn't really improve performance but more sane in my opinion.
if i do find it usefull to save 20 lines of code ill tell u
----------------------------

http://djoubert.co.uk
Advertisement
That's a good fix. It increases readability alot, and doesn't seem nearly as intimidating.

This topic is closed to new replies.

Advertisement