Anthony Robertson
Anthony Robertson

Reputation: 63

Is this possible, LWJGL MovingObjects

I have looked up how to more things in OpenGL / LWJGL. I mean this having an object move relative to the player. Most tutorials tell me that I should use glTranslate and display lists, but I would prefer to do something like what is below:

int y = 0;

while (true){
   y++;

   glBegin(GL_QUADS);
       glVertex3f(-1, y, 1);
       glVertex3f(-1, y, -1);
       glVertex3f(1, y, -1);
       glVertex3f(1, y, 1);
   glEnd();    
}

I know this doesn't work, but I am wondering if there is a similar way to do it that does not involve display lists. If there isn't thats fine, but if there it that would be great!

Upvotes: 0

Views: 38

Answers (1)

Andrew Williamson
Andrew Williamson

Reputation: 8691

If you want an object to move relative to the player, then just don't translate it. This is how a sky-box is normally implemented - you create a rotation matrix from the player's direction, but don't create the translation matrix.

Upvotes: 0

Related Questions