Hi guys.
I am problem with PNG files under OpenGL. The file is an PNG image (256x256) with many levels of transparency.
I am loading it like this:
And I am displaying it on the quad like this:
However, the file is not displayed correctly. It looks disrupted. I suspect that I need to explictly state somewhere the file format to OpenGL?
Do I need to write my own texture loading routine in the case of PNG file?
Thanks for your time.
I am problem with PNG files under OpenGL. The file is an PNG image (256x256) with many levels of transparency.
I am loading it like this:
Code Select
var
Textures: array[1..6] of GLuint;
Textures[4] := LoadGLTextureFromFile('Images\font_0.png');
And I am displaying it on the quad like this:
Code Select
glBindTexture(GL_TEXTURE_2D, Textures[4]);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex3f(-2, 2, 1);
glTexCoord2f(1, 0);
glVertex3f(2, 2, 1);
glTexCoord2f(1, 1);
glVertex3f(2, -2, 1);
glTexCoord2f(0, 1);
glVertex3f(-2, -2, 1);
glEnd();
However, the file is not displayed correctly. It looks disrupted. I suspect that I need to explictly state somewhere the file format to OpenGL?
Do I need to write my own texture loading routine in the case of PNG file?
Thanks for your time.