So.. Yeah. I've never really wanted to bother with loading openGL textures from 
a file, since whenever I looked into it, I had to use a separate library. Now 
that I'm using FLTK, I thought it'd be easy since FLTK has some image loading 
functionality. I tried using a Fl_PNG_Image and using its data(). It will 
display something, but not the image I have on disk, so I guess I'm doing 
something wrong.

This is what I use:

Fl_PNG_Image png("test.png");
..
glGenTextures(1, &TexID);
glBindTexture(GL_TEXTURE_2D, TexID);
glTexImage2D(GL_TEXTURE_2D, 0, 3, png.w(), png.h(), 0, GL_RGB,
    GL_UNSIGNED_BYTE, png.data());
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);

I figure, since it's displaying something, I'm passing the wrong parameters to 
glTexImage2D, but since I've never used that function before, I have no idea 
how I could fix it.
_______________________________________________
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to