glEnable(GL_TEXTURE_2D) problem :(

Started by
0 comments, last by AbeE 22 years, 10 months ago
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.
Advertisement
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)
---I write code.DelphiGL (http://delphigl.cfxweb.net)

This topic is closed to new replies.

Advertisement