I am drawing an image from a full-screen image of openCV, this is a large image at 60 frames per second, so I needed a faster path than openCV gui.
Using OpenGL, I:
void paintGL() { glClear (GL_COLOR_BUFFER_BIT); glClearColor (0.0,0.0,0.0,1.0); glDisable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0,width,height,0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, the_image_data ); glBegin(GL_QUADS); glTexCoord2i(0,0); glVertex2i(0,height); glTexCoord2i(0,1); glVertex2i(0,0); glTexCoord2i(1,1); glVertex2i(width,0); glTexCoord2i(1,0); glVertex2i(width,height); glEnd(); glDisable(GL_TEXTURE_2D); }
Now I want to draw two sides of the image: side - using openGL hardware to scale them.
I can compress the image by resizing the square. I donβt understand how to load two images using glTexImage2 (), since no descriptor or identifier is associated with the image.
source share