why texture2d has no effect?

I cannot see any texture effect using code below:

//*****************************************
glDisable(GL_LIGHTING);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

// bind the texture object
// draw rect that fill the screen

// unbind the texture object
//*****************************************

if I use glDisable(GL_TEXTURE_2D) and glColor3f(1, 0, 0) instead, the result is correct.

can anybody tell me what’s going on with it?

What’s your glTexParameters? In particular, do you use mipmapping and have you set up filtering parameters?

kind regards,
Nicolai de Haan Brøgger

Indeed I’d specified it to earlier as follows:
min filter GL_LINEAR
max filter GL_LINEAR

In fact, I’m using with osg, and there’s no problem with some osg models,

I doubt the completeness of my texture completeness,and so it’s affected by some scene graph nodes and not for the others, but I donn’t know how to validate it

Do you set the texture coordinates correctly?

yes i did. any other reasons?

the problem is not come from common and the usual way of using texture. it comes from integrating common use of texture with the use of OSG, the use of CEGUI.

if i use glPushAttrib(GL_ALL_ATTRIB_BITS) together with glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS) before calling the draw method of OSG, and pop the attributes afterwards, the result seems good, except some objects loaded and processed, and rendered by OSG “disappeared” in the view.

and, if i do not save and restore any attributes for OSG rendering, but instead disable GL_TEXTURE_2D of my own texture outside of OSG, the result seems to be right.

So, the result I can get is that the problem is related with GL_TEXTURE_2D, and vertex array.

CAN anybody tell me, when using texture in OpenGL, what’s the possible reason for cannot output any color from bound texture with lighting disabled and blended disabled, JUST as the code ABOVE showed?

Many thanks to you guys already answered …

Has your texture dimensions of powers of 2 ?

yes it is 512*512

Does texturing work when you call gluBuild2DMipmaps() with a dummy texture after your glBindTexture() (just for debugging)?

If yes, the problem is likely texture completeness(mipmaps enabled but not specified).