Texture mapping

I cannot get texture mapping to work.
I have created a context.
I have enabled 2d texture mapping.
I have generated a texture name.
I have bound the texture name to 2d textures
I have used the following to setup my texture

glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, array)

where array is a [2562563] byte array of texture data.

I setup my quad with texture coords for each corner but when I display the quad it appears coloured with no texture.
I have re-bound the texture before calling glBegin but still nothing.

I have used glGetError but it reports that nothing is wrong. Please help as I have run out of ideas.

[This message has been edited by stim (edited 06-25-2001).]

Can you post more code!

When you say it appears colored, are you saying that that color is the primary color? Or does the color change depending on the texture used? If the color changes as the texture changes, then it sounds like texture mapping is working fine, and that its the texture coordinates that are bad (or possibly the texture matrix).

this is the setup code…
(I have omitted the error checking code for space)

glGenTextures(1, &m_nTexture);
glBindTexture(GL_TEXTURE_2D, m_nTexture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, array);

this is the drawing code…

glBindTexture(GL_TEXTURE_2D, m_nTexture);
glTexCoord2d(0,0); glVertex2d(-1,-1);
glTexCoord2d(1,0); glVertex2d( 1,-1);
glTexCoord2d(1,1); glVertex2d( 1, 1);
glTexCoord2d(0,1); glVertex2d(-1, 1);

the quad is rendered white only.
is this enough code?

[This message has been edited by stim (edited 06-25-2001).]

For each texture binded you must set Min and Mag Filter property.


For some reason if you don’t set these properties, the texture isn’t displayed.

I have the same problem one week ago (RIVA TNT)

[This message has been edited by Boresight (edited 06-25-2001).]

I tried that but The texture appeared black.

Is it possible to make textures affected by lighting? I have a moon texture and I want the light to go around like the sun.

Thank you Boresight. The texture parameters worked. I was using a blank texture. Doh!

Hehe… done that to.

but what if i want 2 textures and want to set witch texture should show most ?