Archived

This topic is now archived and is closed to further replies.

glEnable(GL_TEXTURE_2D) problem :(

This topic is 6023 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a ''plane'' of triangle strips set up, stored them in a display list and I call the display list to view and walk around them. I had them coloured purple using glColor3f(...), I have also setup a FPS counter which I had coloured blue. I decided I would texture the triangle strips with grass texture to make it look as though it a ''grassy plane''. BUT if I enable GL_TEXTURE_2D everything went black (except for my background-glClearColor3f(..white..).) This included the ''plane'' and the text. But if I change the planes colour to 1.0,1.0,1.0 (white) the texture is normal, its as if the glColor is affecting its brightness. I did the same with the text but as I turn its color to 1.0,1.0,1.0 it goes green like the grass. Its a bit wierd, I don''t have GL_COLOR_MATERIAL enabled or anything!! Any help is appreciated, hopefully its something simple.

Share this post


Link to post
Share on other sites
I believe that the texture is multiplied with the triangles color, therefore if you set the color of the quad to black (0.0) then the triangle will be black.

To fix this you can call glTexEnvi and set the texture environment to GL_REPLACE or GL_DECAL (try both, one of them works) like so:

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

To get FPS to show up normally, call glDisable(GL_TEXTURE_2D) before drawing the FPS.

Jason A.
DelphiGL (http://delphigl.cfxweb.net)

Share this post


Link to post
Share on other sites