Texuring

Started by
9 comments, last by Ertai 22 years, 6 months ago
I finally was able to draw a textured quad. don''t laugh .. well .. i generated a texture that has RGB value 255,0,0 all over ... but the quad appeares in some kind of dark shade of red ... like there is some dark lighting applied or something ... can anyone tell me what could be the problem ?
Stefan
Advertisement
As you probably suspect, there is no such thing as dark lighting.
Instead, OpenGL defaults to pretty dim ambient lighting.
you can change it either by calling glLightModeli and setting the diffuse+ambient to (1,1,1) - bright light, or enable a new light source which will be brighter.


--------------------
so, what you''''re saying is, that the mushroom spores were brought in from outer space by - who?? -cosmosis
--------------------I believe I think, therefor I believe I am
Sorry, isn''t there such a thing as no lighting ?
Stefan
glDisable( GL_LIGHTING )

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
Yeah, i tried that, but it doesn''t seem to work ...
the darkness of the texture does seem to depent on glColor() though ...
Stefan
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE )

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
Hey! It works! ehm, what did I just do ?

btw, i will be wanting to apply lighting to my texture .. is that still possible when i called this line ? i want to use vertex lighting ...
Stefan
Actually i have some more questions:

I know how to use display lists now, i heard they are used to achieve speed increase, is there some tut on how and where to use them ? you know, to benefit the most from ''em

Is there some overview of GLState variables, parameters, whatever ... because there are a whole lot of things like Texture Environment i have never heard of .. I just can''t really get a overview of the opengl system ...
Stefan
That call controls how you texture is combined with the color-fragment. You were either blending or modulating the texture with the color. I tried to find out what the default is but couldn''t find it. THere are 4 modes: GL_MODULATE, GL_REPLACE, GL_DECAL, GL_BLEND. GL_REPLACE discards the fragment color and just uses the texture to color the polygon. You can''t use that mode for lighing since the lighting will be discarded. What you will want to do is render you polygons with what ever lighting you require and then use the same call with GL_MODULATE. I think the opengl super bible and the old edition of the red book are online so look them up on google. I recommend buying the red book but you might want to wait until the new 1.3 red book comes ouyt.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
Ahaaaa, i get it! and it makes sense too !
so, i also know how to do vertex lighting ... great

there is another thing i don''t get, I know about the GL_PROJECTION, GL_MODELVIEW and GL_TEXTURE stacks .. i know how to select them, how to manipulate the current texture of the selected stack and everything ... but i don''t know what they are doing and how and all ...
i know the GL_MODELVIEW currect matrix is used to render a model to the right position on the screen, and i even know how to do this, using glTranslate and glRotate but how is the matrix used to generate a Sreen.x and Screen.y from a World.x World.y and World.z ?
Stefan

This topic is closed to new replies.

Advertisement