Does OpenGL have a simple function that loads texture from a resource file, so I could get rid of (HBITMAP)LoadImage();
function that I use instead.
As an example in DirectX it can be done by D3DXCreateTextureFromResourceA();
function.
Does OpenGL have a simple function that loads texture from a resource file, so I could get rid of (HBITMAP)LoadImage();
function that I use instead.
As an example in DirectX it can be done by D3DXCreateTextureFromResourceA();
function.
Use Qt, you will find it's easy to write code with OpenGL.
You can load a lot of image with different formats.
QString fileName = QFileDialog::getOpenFileName(this, "open image file", ".", "Image files (*.bmp *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm);;All files (*.*)");
QImage image;
image.load(fileName);
Also, it is easy to change normal image to OpenGL texture.
QImage textureImage = QGLWidget::convertToGLFormat(image);
GLuint glTexture;
glGenTextures(1, &glTexture);
glBindTexture(GL_TEXTURE_2D, glTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureImage.bits());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);