Advertisement

PixelFormatDescriptor Question.

Started by April 09, 2002 06:57 PM
1 comment, last by ChacaL 22 years, 10 months ago
What differ between these two PixelFormat codes: ----------------PixelFormat 1---------------- PIXELFORMATDESCRIPTOR pfd; pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.dwLayerMask = PFD_MAIN_PLANE; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = SCREEN_DEPTH; pfd.cDepthBits = SCREEN_DEPTH; pfd.cAccumBits = 0; pfd.cStencilBits = 0; --------------------------------------------- ----------------PixelFormat 2---------------- PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, SCREEN_DEPTH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0, }; --------------------------------------------- With ''PixelFormat 2'' I get 40 FPS at my proggie with windowed mode, but I can''t use texture masking in ortho mode to draw a crosshair. The program crashes when binding the mask texture before the crosshair texture. If I swith to #1 I can bind the two textures (mask, and crosshair), but the FPS drops down to less than 10 at windowed mode. At fullscreen mode the performance is the same with the two PixelFormats, but I still cannot bind the mask with #2. Also, the graphics quality is the same in both PixelFormats. Why this? Anyone who could help me? I just can''t understand all this PixelFormatDescriptor paramethers. Thank you mates! See you. P.S.: Sorry about any English errors!
The only difference is in the first snippet only the required areas are being intialized and in the second one everything is being initialized.

The first snippet should be preceeded with memset(&pfd,0,sizeof(pfd)); to fill the whole structure with zeros.

check out the msdn documentation on the pfd structure.
Advertisement
Ok, but I''m still not undertanding what makes the #2 reach 40 FPS at Window and crash when trying to bind the mask texture.

Any ideas?

Thank you!

This topic is closed to new replies.

Advertisement