Sergio Moura
02-11-2009, 04:57 AM
Hello, people!
I have a question of math. I don't know how I should call that, but I'll try to explain my problem as clearly as possible.
I have a scene drawn. Let's assume it's an infinite plane, with normal vector (0,1,0) in the origin.
Now, I have numerous (hundreds) billboards above this floor. The texture to be drawn in the billboard depends on the direction of the camera relative to the billboard. I have 8 textures for each billboard (N, NE, E, SE, S, SW, W, NW), and, according to the angle with the "billboard direction vector" and the "camera vector", I'll decide wich one to draw, such as:
If the camera is N (0,0,1) and the billboard direction is N, I'll draw the texture "N", but if the billboard direction is "S", I'll draw the texture "S".
If the camera is S (0,0,-1) and the billboard direction is "N", I'll draw the texture "S".
My question is, How do I know, using the OpenGL functions, how to determine the direction the camera is facing.
Thanks everyone!
- Sergio
I have a question of math. I don't know how I should call that, but I'll try to explain my problem as clearly as possible.
I have a scene drawn. Let's assume it's an infinite plane, with normal vector (0,1,0) in the origin.
Now, I have numerous (hundreds) billboards above this floor. The texture to be drawn in the billboard depends on the direction of the camera relative to the billboard. I have 8 textures for each billboard (N, NE, E, SE, S, SW, W, NW), and, according to the angle with the "billboard direction vector" and the "camera vector", I'll decide wich one to draw, such as:
If the camera is N (0,0,1) and the billboard direction is N, I'll draw the texture "N", but if the billboard direction is "S", I'll draw the texture "S".
If the camera is S (0,0,-1) and the billboard direction is "N", I'll draw the texture "S".
My question is, How do I know, using the OpenGL functions, how to determine the direction the camera is facing.
Thanks everyone!
- Sergio