This is a very basic question, but I haven’t been able to find an answer to it. I’m trying to display a red triangle. Following lesson 3 of NeHe’s tutorial, I tried the following code:
But the result is a completely black triangle. I’m able to use texCoord to texture map the triangle, but I’m not able to simply color it without texture mapping it. (BTW: I’m using c#).
Like always, try rendering points, see if they have different colors, then lines, then … Play with the GL to debug. If you aren’t texturing, then textures should in fact be disabled.
ugluk, thanks. I’m making progress. Points are too small, so I started with a line. I’m having trouble turning off textures… I can actually get things to work as I’d expect with this code:
It draws a white line, just as it should. However, if I prefix the above code with these lines:
GL.ActivateTexture(TexID.Tex1);
GL.BindTexture(TexMode.Tex2D, TexID.Tex1);
GL.Enable(GLFeature.Tex2D);
GL.Disable(GLFeature.Tex2D);
Then, it draws a gray line. I realize it’s silly to enable a texture only to disable it the next line. But in the future, I’d like to draw some things with textures and others without. So, right now I’m trying to figure out how to disable textures. Obviously, glDisable(GL_TEXTURE_2D); doesn’t do the trick. What lines of code are required, then, to disable textures?