DrawDibDraw draws to screen,not texture

Started by
6 comments, last by Leroy1891 21 years, 1 month ago
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?
Advertisement
Just do like in the lesson 35... it draws to a texture. DrawDibDraw draws in a buffer first and that buffer is set to a opengl texture.
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();
}
Did you create a dib section first and did you do a SelectObject() on the hdc and the hbitmap returned by CreateDIBSection()?
yes i did. here are the lines if you want to look at them

HBitmap = CreateDIBSection (Hdc, (BITMAPINFO*)(&Bmih), DIB_RGB_COLORS, (void**)(&Data), NULL, NULL);
SelectObject (Hdc, HBitmap);
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.
that got it so it doesn''t draw to the screen anymore but it still won''t draw to the texture. i checked my hdc right before
getting the frame and it is not 0.
Now it can be lots of things... Can you send me the whole class source? send it to v_d_d@yahoo.com

This topic is closed to new replies.

Advertisement