Jump to content
  • Advertisement

braineater1988

Member
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

122 Neutral

About braineater1988

  • Rank
    Newbie
  1. braineater1988

    Making the light to stay fixed as player moves

    Hi Well, my code started working just before i saw your reply. The problem was that i was setting the frustum in the modelview matrix rather than the projection matrix. Also, this: allegro_gl_apply_quat(&camera.orientation); glTranslatef(-camera.position.x, -camera.position.y, -camera.position.z); glLightfv(GL_LIGHT1, GL_POSITION, position); is the right way to do it. Thanks for your reply.
  2. Hi I've been learning OpenGL in the past few days (I'm using AllegroGL). I've really been having trouble with having the light to NOT move with the player. Whatever I try, I am not able to correctly do it. I'm trying to do it for a directional light(w=0). I've put my code from the redraw function here. Can anyone see any evident problems?? =============================================== GLfloat position[]={0, -1, -1, 0}; glLoadIdentity(); glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 240.0); allegro_gl_apply_quat(&camera.orientation); glTranslatef(-camera.position.x, -camera.position.y, -camera.position.z); glBindTexture(GL_TEXTURE_2D, texture); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //Just applying the transformations to the light separately, for trial and error glPushMatrix(); glLoadIdentity(); allegro_gl_apply_quat(&tmp); //glTranslatef(-camera.position.x, -camera.position.y, -camera.position.z); glLightfv(GL_LIGHT1, GL_POSITION, position); glPopMatrix(); glBegin(GL_QUADS); ... ... glEnd(); /* Flip the backbuffer on screen */ allegro_gl_flip();
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!