Skip to main content
gamedev.net
🔒 Locked

Using glScalef?

Started by mlt 1 reply 3k views
Original Post
mlt
mlt
I use glScalef to flip an object about the z-axis. But when I flip it it is almost totally dark. I thought it was ONLY the object that was flipped and not also the light position. Here is the code:

glPushMatrix();
 // Flip object upside down (reflect around z-axis).
 glScalef(1.0, 1.0, -1.0);
 render_bob(camera_pos[0], camera_pos[1], camera_pos[2],   m_sun_position[0], m_sun_position[1], m_sun_position[2]);
glPopMatrix();


Are both the light position and the object flipped but not the camera position?
scwizzo
scwizzo
If you are rendering the light relative to the render_bob() function then it is going to flip the light too. Is the camera an actual viewport, or is it a position? Things are flipped relative to the viewport.
/ Visual Studios 2010 / Codeblocks 10.05 / Windows 7 / Ubuntu 10.10 / - I might be wrong
Sneftel
Sneftel
Quote:
Original post by mlt
I thought it was ONLY the object that was flipped and not also the light position.

Neither the light, nor the object, nor the camera is directly flipped. The active matrix (probably the MODELVIEW matrix) is "flipped" (or, rather, has a flip postmultiplied onto it), which then affects drawing commands which come afterwards. glLight(GL_LIGHT_POSITON) multiplies the passed-in position by the current model-view matrix, so changing the model-view matrix will affect it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.