Getting object coordinates from camera
Posted
by
user566757
on Stack Overflow
See other posts from Stack Overflow
or by user566757
Published on 2011-01-07T15:45:26Z
Indexed on
2011/01/07
15:54 UTC
Read the original article
Hit count: 199
I've implemented a camera in Java using a position vector and three direction vectors so I can use gluLookAt();
moving around in `ghost mode' works fine enough, but I want to add collision detection. I can't seem to figure out how to transform my position vector to coordinates in which OpenGL draws my objects.
A rough sketch of my drawing loop is this:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
camera.setView();
drawer.drawTheScene();
I'm at a loss of how to proceed; looking at the ModelView matrix between calls and my position vector, I haven't found any kind of correlation.
© Stack Overflow or respective owner