Advertisement

Why my CuBe is brown???

Started by August 01, 2004 03:38 PM
2 comments, last by Dybbuk 20 years, 4 months ago
Thanks for the help with my BMP i figured it out. But... when I load the BMP everything is OK. When i create my window i use glEnable(GL_TEXTURE_2D) to enable textures. Ok I load BMPs but when i try to bind them to texture variable (hey I cant find the words...), you know... the variable that you use with glGenTextures(....,DaVariable); :) And when i do this... everything`s Ok. Now i call DrawCube() to draw my cube, but in this functions i didn`t use glTexCoord2f() not even once! and the cube is... brown!!! and the <brown-color-intensity> depends on the binded texture.... I cant figure it out so please help :)
If your intent is to draw a cube with solid colors, try putting glDisable(GL_TEXTURE_2D); before you call the function (or inside it).
Advertisement
Soo... What exactly is your problem? To show the texture, you need to specify texture coordinates. If you don't want to show a texture you need to disable texturing.
If at first you don't succeed, redefine success.
If you don't specify texture coords, but you DO enable textures, the last texture coord is used for all vertices. (If no texure coords are specified yet, it is probarbly 0)
Thus all points have the same texture coordinates, wich mean they all have the same color, and the spave between them is that same color too. Wich explains the solid colored cube.

Read the chapters about textures and the part in the intro wich explains openGL is a state machine, if you want to understand why your cube is brown.

This topic is closed to new replies.

Advertisement