PDA

View Full Version : Rendering on a Bitmap (Small Problem)


person23
2003.03.27, 01:50 PM
Hallo Experts,

I have a Question to Bitmap-Rendering!
I am rendering some thing on a Bitmap (I must not use a Window).
But when I whant to render some thing new on the bitmap nothing happens.
Becaus the bitmap has no backroundbuffer I can not swap the buffers (understandable).
How can I handle this Proplem?

I think I have forgotten something smal linke "MakeCurrent" or something like that
Please have a look at me code:

hdc= .... (from a bitmap)

PIXELFORMATDESCRIPTOR pfd = {.... , PFD_DRAW_TO_BITMAP , ...};

SetPixelFormat(hdc,ChoosePixelFormat(hdc, &pfd),&pfd))

hrc = wglCreateContext(hdc);

wglMakeCurrent(hdc, hrc);

glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);

glColor3b(0,0,100);
glBegin(GL_POLYGON);
glVertex3f(-1,-1,0);
glVertex3f(1,-1,0);
glVertex3f(1,1,0);
glVertex3f(-1,1,0);
glEnd();

glFlush();

//************************************************** ****************
// Until here I have no Problem!!!!!!!!!!!!!!!
// The bitmap has changed!
// But when I want to render something new onto the bitmap
// nothing changes in the bitmap
//************************************************** ****************

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3b(50,50,50);

glBegin(GL_POLYGON);
glVertex3f(0,0,0);
glVertex3f(1,0,0);
glVertex3f(1,1,0);
glVertex3f(0,1,0);
glEnd();


Who can help me?
Thanks!!!!!!!!!!!!!!!!!!

OneSadCookie
2003.03.27, 04:25 PM
I doubt anyone can help you. This is a Macintosh programming forum, and that looks very much like a Windows problem.

Mars_999
2003.03.28, 09:48 PM
Originally posted by OneSadCookie
I doubt anyone can help you. This is a Macintosh programming forum, and that looks very much like a Windows problem.

Ah yeah that is 100% pure windows code I know I just got done coding a choosepixelformat() and hdc is a handle to device context struct. Oh yeah winblows coding!! Do yourself a favor and go out and buy a Mac and throw that PCee in the trash!!