Jump to content
  • Advertisement

Archived

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

Leroy1891

DrawDibDraw draws to screen,not texture

This topic is 5577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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
Did you create a dib section first and did you do a SelectObject() on the hdc and the hbitmap returned by CreateDIBSection()?

Share this post


Link to post
Share on other sites
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);

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
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.

Share this post


Link to post
Share on other sites
Now it can be lots of things... Can you send me the whole class source? send it to v_d_d@yahoo.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!