got some probs with spec. lighting
from the phyisical view, spec.l. is a mirror effect.
so if i had a sphere, a near point light and my view, if only one component moves, the specular highlight travels over the spheres surface. but in all my codings, it behaves like diffuse light, stying on the light nearest point of the sphere.
i also know about the very important switch
which i dont forgot.
so what else could be problematic??
i also positioned the light source once, or in my main loop.
is this important, must this be done in a special place (when in projection/modelview stack?)
currently if only the viewer moves, the lights sty static, only “projection” changes, but every vertex-value stays constant.
would be grateful to any help & greets
It sounds like you’ve “attached” the light to the viewpoint. This easily happens if you don’t apply the viewmatrix to the light. So you should do something like this
glMatrixMode( GL_PROJECTION );
- set projectionmatrix to the projection you want (ortho/perspetive…)
glMatrixMode( GL_MODELVIEW );
set modelview-matrix to identity
apply viewing-matrix (gluLookat or similar)
do the glLight( GL_POSITION, … ) call.
render models with proper modelling-transformations.
Think of the light as any other object. So if you for example wanted the light to move “attached” to another object, you would apply the same modelling transformations to this, as the object;
glLight( GL_POSITION, … )
- not really an advanced topic though, now is it?
Hope this helps
my main mistake was to place the VIEWPOINT inside GL_PROJECTION stack.
(as for mine, it sounds like there’s the right place…)
you’re right, thats not widely advanced. but most non adv. questions talk about “how can i see anything?” and i thought i was doing all right, so blamed the bug on trapping in some opengl details which are hard to track…
all working now, much thanks for the help