PDA

View Full Version : glDrawPixels mirror



05-28-2004, 10:52 AM
I have a pretty straight forward rendering function that uses glDrawPixels. Problem is that the image is mirrored horizontally.


glDrawPixels(256, 256, GL_LUMINANCE, GL_UNSIGNED_BYTE, static_cast<const GLvoid*>(m_Data));
// where m_Data is a pointer to the pixels that are unsigned BYTE's from 0-255TIA

shinpaughp
05-28-2004, 02:55 PM
My only thought is that you are using data assuming that the origin is at top left whereas in OpenGL origin is at bottom left. You will need to adjust how you populate your array.

miko
05-30-2004, 04:35 AM
or you can use glPixelZoom(1,-1)

EDIT: errmm.. horiznally? glPixelZoom(-1,1) could be a solution but i don't have an idea what kind of mistake could result in horiznotally mirrored image. it must be something with your array (e.g. at time of loading you are filling it from last element to first:)). try to fix it, then you can try glPixelZoom(-1,1))