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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!