Skip to main content
GameDev.net gamedev.net
🔒 Locked

Help with vertical flipping

Started by vasanthm Dec 11, 2005 at 9:12 PM 3 replies 3.6k views
Original Post
vasanthm
vasanthm
Hello Everyone, I am new to this forum and new to OpenGL... You help is very much appreciated.. I am currently obtaining video pixel information from a webcam and plotting them on a openGL window but the display is inverted. To display the pixels i am using glDrawPixels(w,h,GL_BGRA,GL_UNSIGNED_BYTE,buffer); updateGL(); the above code displays my video frames but is inverted. If i add glPixelZoom(1.0f, -1.0f); before glDrawPixles to invert the display the display goes blank... please help... thankx in advance vasanth
vasanthm
vasanthm
thanx for the reply


i am now using

glPixelZoom(1.0f, -1.0f);
glRasterPos2f(-1,1.0);
glDrawPixels(w,h,GL_BGRA,GL_UNSIGNED_BYTE,c1.buffer);


this does flip the image and displays it right but the top 25% is still blank and glRasterPos2f seems to take values only from -1 to +1 .. please advice


vasanth
vasanthm
vasanthm
when i do this

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0 ,width(), 0, height(), -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();


glRasterPos2i(0,height());
glPixelZoom(1.0f, -1.0f);

glDrawPixels(c1.getWidth(),c1.getHeight(),GL_BGRA,GL_UNSIGNED_BYTE,c1.getBuffer());


I get a blank screen but if I change it to glRasterPos2i(0,height()-1); I get the display but the top 33% (aprox) is still blank.. its like the image needs to be moved up a bit.. Sorry to sound like a noob.. i ahve never worked with openGL and I just need to get this working before I proceed to other parts whih has nothing to do with openGL

thanx in advance
vasanth

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.