Jump to content
  • Advertisement
Sign in to follow this  
ssarangi

OpenGL Streaming video behind geometry with OpenGL

This topic is 3365 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

Hi all, I am kind of stuck with this problem for sometime now. I have a video source from which I get an array of pixels which I need to display on the background. However, infront of this video I need to have geometry displayed. The Problem is I managed to get both the video and the model to be displayed -- the video with glDrawPixels and the model in the regular way. However I need the model to be always infront of the video and not be hidden by it. Currently, ( IMO the pixel is being display at Z value 0 ) when i rotate and move around the geometry it goes behind the array of pixels.. I display the array of pixels always before I redraw the geometry but still it happens. So I was wondering what would the way to avoid this.... Thanks glClearColor(0.0, 0.0, 0.0, 0.0); glPushMatrix(); gluOrtho2D(0, 256, 0, 256); glLoadIdentity(); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); makeCheckImage(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glRasterPos3f(0.0, 0.0, 0.0); glDrawPixels(256, 256, GL_RGB, GL_UNSIGNED_BYTE, &checkImage); glPopMatrix();

Share this post


Link to post
Share on other sites
Advertisement
Why don't you draw your object first (and modify the stencil buffer so that the stencil buffer has "1" where the object pixels are), then draw a textured quad for the video w/ stencil test (so it doesn't overlap the model) ?

Share this post


Link to post
Share on other sites
Thanks, your idea worked...

Also did one more thing which worked and that was to disable the depth mask when drawing the pixels for the video.
Thanks....

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!