PDA

View Full Version : Trouble with glDrawPiexls



linghuye
11-26-2004, 11:27 PM
I learn to use glDrawPiexls to draw a bitmap on a top main window, and it works well.
But when I use the same code on a ChildView of a main window, It doesn't work, so I wonder why? Can "glDrawPiexls" be used on a child window?

The calling is simple as below:
glRasterPos2i(0, 0);
glPixelZoom(1.0f, -1.0f);
glDrawPixels(640, 480, GL_RGBA, GL_UNSIGNED_BYTE, m_pImageData);

And the pixel format as:
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
16,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
16,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0,
};

My env is Windows2000, Vs.net7.1,opengl1.0

And if anyboady have a sample code which show the usage of glDrawPixels on a child window, please let me know.
Thanks advanced.

mikael_aronsson
11-27-2004, 06:01 AM
Hi !

make sure you have switched the OpenGl context to the child window (wglMakeCurrent...)

Mikael

12-01-2004, 01:40 AM
Of course I do.
I am sure to create the opengl context on the childview, And other opengl render functions work well on this childview except the DAMN glDrawPixels.
You can try it yourself, The test is simple,just show me a working glDrawPixels on a child window.