Archived

This topic is now archived and is closed to further replies.

Leroy1891

DrawDibDraw draws to screen,not texture

Recommended Posts

i am trying to put lesson 35 into a class for easy use. however when drawdibdraw is called it draws the frame to screen instead of the texture. also it flickers even when i tell it to stay on the first frame. i went through and commented out all the opengl drawing in lesson 35 figuring that i would see the frame drawn to screen like in my class but it doesn''t draw anything. this is why i believe it is drawing to the wrong thing. do i have to set something to a certain value to get drawdibdraw to draw to a texture instead?

Share this post


Link to post
Share on other sites
I am using the same code from lesson 35 to do this. my drawframe
function looks like this:
void AVIFile::DrawFrame(int Frame)
{
LPBITMAPINFOHEADER Lpbi;
Lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(Pgf, Frame);
Pdata=(char *)Lpbi+Lpbi->biSize+Lpbi->biClrUsed * sizeof(RGBQUAD);

DrawDibDraw (Hdd, Hdc, 0, 0, 256, 256, Lpbi, Pdata, 0, 0, Width, Height,0);

glTexSubImage2D (GL_TEXTURE_2D, 0, 0,StartY, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, Data);

glBegin(GL_QUADS);
glTexCoord2f(0.0,0.0); glVertex3f(-0.5,-0.5,-2.0);
glTexCoord2f(1.0,0.0); glVertex3f(0.5,-0.5,-2.0);
glTexCoord2f(1.0,1.0); glVertex3f(0.5,0.5,-2.0);
glTexCoord2f(0.0,1.0); glVertex3f(-0.5,0.5,-2.0);
glEnd();
}

Share this post


Link to post
Share on other sites
If it still draws to the screen, then it is probably because the hdc == 0.

Step debug the line:

DrawDibDraw (Hdd, Hdc, 0, 0, 256, 256, Lpbi, Pdata, 0, 0, Width, Height,0);

and check the value of Hdc. It must not be zero.

Hdc must have been created with CreateCompatibleDC(0) first.

Share this post


Link to post
Share on other sites