I am developing an app with OpenGL. Here is my hierarchy:
GLImage(my own object) which is a GLDisplay object (also my own object) which is a QGLWidget.
I have written the paintGL() method in GLImage and intializeGL and resizeGL in the GLDisplay
class.
I have CameraImage class (my own object) that is inherited from another class (my own - DisplayMdiWindow) that inherits from QMdiSubWindow.
In the CameraImage class, I set the GLImage instance as the widget of the window using setWidget();
What I want to do is to display an image in the GLImage class. In paintGL(), I have:
Qt Code:
glRasterPos(0,0); // the x,y to start drawing at glDrawPixels(imageWidth, imageHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, buffer);To copy to clipboard, switch view to plain text mode
I believe that, for C++, drawing the pixels starts at (0,0) in the left hand corner and then draws the width and height that I specify.
What I have noticed is that while the bottom left is 0 for the x-coordinate, 0 does not appear to work for the
y-coordinate because I don't see anything. I've tried values like 10, 20, etc for the y_coordinate and doing so
moves the image up a little but depending on the size of the CameraImage window, the image sometimes gets cropped. I even tried to start drawing at the top left corner (0, viewport height) but that was wrong as well.
I've looked through the forums and online to see if there is any additional information about QGLWidget and glDrawPixels but I haven't seen any.
Is anyone trying to do something like this?
Thanks,
Nisha
Bookmarks