Vertex position in projection
I`d like to apologise in advance for what is probably a newbie question, I''ve only been programming OpenGl seriously for a few days and I`m learning as I go..
I''m trying to create what I think is a fairly simple effect - I have a few cubes in a scene and I can rotate the view around the origin and move the view in and out from the origin with the mouse (if you''ve played Homeworld you''ll know the sort of thing). I want to make a fake "light" which appears ot be on one vertex of one of the cubes. The light turns on and off periodically. I can create the colour change effect without problems using some trickery based on the number of millis the program has been running anded with 2048 (which produces a roughly 2 second on/ one second off effect) and glMaterialfv()
What I want to do now is place a quad centred over the vertex the "light" is at, with a transparent texture to simulate a glow. This would be farily simple.. except that to create the "glow" effect the quad must always face the viewpoint. I''m not really sure how to go about that though, as far as I can see I need to:
- Work out the vector from the vertex to the eyepoint
- Normalise the result
- use the equation of a plane to calculate the four corners
- draw the texturemapped quad
Am I on the right lines? Is there a more efficient way I can go about this?
May 18, 2001 05:30 AM
Wow, you have certainly done a lot in a few days. It is called billboarding and here is one example http://www.sgi.com/software/opengl/advanced97/programs/programs.html
You can do a search if you need more information or look in the red book.
You can do a search if you need more information or look in the red book.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement