void imageDisplay::showImage()
{
glEnable(GL_TEXTURE_2D);
drawTexture
(QRect(0,
0,
1,
1),texture,GL_TEXTURE_2D
);
glDisable(GL_TEXTURE_2D);
}
void imageDisplay
::loadImage(QImage &img
) {
width_img=img.width();
height_img=img.height();
glEnable(GL_TEXTURE_2D); // Enable texturing
glBindTexture(GL_TEXTURE_2D, texture); // Set as the current texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.width(), img.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glDisable(GL_TEXTURE_2D);
updateGL();
return;
}
void imageDisplay::showImage()
{
glEnable(GL_TEXTURE_2D);
drawTexture(QRect(0,0,1,1),texture,GL_TEXTURE_2D);
glDisable(GL_TEXTURE_2D);
}
void imageDisplay::loadImage(QImage &img)
{
width_img=img.width();
height_img=img.height();
glEnable(GL_TEXTURE_2D); // Enable texturing
glBindTexture(GL_TEXTURE_2D, texture); // Set as the current texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.width(), img.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glDisable(GL_TEXTURE_2D);
updateGL();
return;
}
To copy to clipboard, switch view to plain text mode
Bookmarks