PDA

View Full Version : Trying to texture a quadric sphere..



delic
10-06-2002, 09:15 AM
Alright I have figured out a lot of mistakes but now I have a problem getting the
glTexImage2D function to work.. I load a bitmap using LoadImage and then get the data using
GetObject(pbitmap, sizeof(BITMAP), (LPSTR)&bmp);
I don't know how to set the internal format, type, and format of the glTexImage2D call to get it to work. I am getting no errors but it just puts a black screen up. If I comment out the call I get my quadric sphere, untextured of course.

I am calling it as follows:
glTexImage2D(
GL_TEXTURE_2D,
0,
GL_RGBA8,//internalformat
bmp.bmWidth ,//width
bmp.bmHeight ,//height
0,//border
GL_RGBA,//format
GL_UNSIGNED_BYTE,//type
bmp.bmBits );



[This message has been edited by delic (edited 10-06-2002).]

Bob
10-06-2002, 10:00 AM
All I can think of is that you image does not have height and width as a power of two (1, 2, 4, 8, 16 ...) and/or you don't change the default minification filtering to a non-mipmap filter (GL_LINEAR or GL_NEAREST), since default minification filter requires a complete mipmap chain.

I also suggest you remove the '8' in the internal format. That way you let the driver choose the internal format, and I'm sure it will do a better job finding the proper format for the texture.