texturemapping / shading

hi lwgl-coders !

i’m not a java newbie but just at the beginning of opengl.

nehe-tutorials are great.
i learned a lot. fine !

but now my problem:

i build a textured sphere called “earth”.
earth looks right.
after textured sphere
i placed a shaded quad.
if quad is white colored - everythings’ ok.
if quad is red or blue colored, “my earth” will be shown
for one moment correctly - >
and than the earth contours are completly red or blue.

my workaround is to draw a small white quad out of sight.
my earth look well again.

any ideas ?

thanks a lot,
and “good code !”
olaf

Yep, set the current colour to white before drawing the sphere.

OpenGL doesn’t reset any state at the start of your scene rendering, so the last colour you’d used at the end of the previous loop will have still been in effect and been combined with the texture colours in some way (depending on your texture settings).

Which means you don’t have to draw a white quad, just call glColor with white.

Or turn off texture colour modulation:


GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);

Cas :slight_smile:

Hi ;D

texture Modulation is also the right trick to do it ?

This strange effect is complete new to me, are there some
more things like this to know ?

  • jens

hi princec !


GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);

this glMethod makes my texturemapping look like i want.
but my multicolored grid is white only .

only draw a white-shaded thing at last helped.

greetZ,
olaf

You have to turn this feature on when you want to use it, and off when you don’t. To modulate the colour of the texture with the current glColor, use


GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);

Cas :slight_smile: