Phong Shading in OpenGL, Writing Text to the Screen

I want to either implement Phong Shading in in OpenGL or plug in some code that’s lying around that does this. My main problem is that I don’t know how to iterate through each pixel to apply the formula.

I also want to text in OpenGL. Is there a library out there that does this? The text needs to be 3D so I can perform transformations on it. (I am using a Solaris machine, and I don’t know how to extract the font information on this platform.)

Any help would be appreciated.

[This message has been edited by Rubia (edited 12-02-2000).]

If all you want is white highlights showing
reflections from a light source, you can
turn on specular lighting. However, that
does not use the Phong algorithm. If you
need Phong explicitly, there’s a trick you
can play with cube environment mapping and
the register combiners if nVidia hardware
which is documented on their development
site; if the Solaris hardware has similar
low-level access you might be able to do the
same thing.

There was an link to an article on a few weeks ago. The managed phong shading by using a texture (shaped like a light spot) environment mapped on the object. Looked really good!

Consumer 3d hardware doesn’t currently implement phong shading although some cards can get close enough (Notably GeForce’s) by interpolating the half angle vector across a triangle, then a cube map is used to make sure the vector is reasonably normalised and finally a per pixel dot product with the light vector is done.

Pulling off the Phong illumination model is a little bit trickier due to the power term, and of course there’s a plethora of other hacks you can use to simulate specular highlights…

Using Light Map is Okay but gets expensive to dynamically regenerate the light maps if need be. Otherwise a lot of artwork is required to match the scene according to it’s lighting conditions. NVidia has come up with per pixel lighting with NSR (NVidia Shading Rasterizer) which is excellent. Also there is an extension hint for Phong Shading.