Hi all -- Back when the OpenGL 3 discussion broke out on this list last fall, there was some talk about how functions like glutSolidTeapot would have to be written for OpenGL 3. The issue is really larger than just the fact that the underlying evaluators API has gone away in GL 3.1. Let me explain.
Currently, glutSolidTeapot() is really a black box, an object, and you don't know or care how it draws the teapot. In OpenGL 2.x, you can set state just about any way you want, then call that function and render the teapot with that state.
Consider how this changes in OpenGL 3. What you _might_, naively, want to do is create a shader to control the appearance, call glUseProgram, then call some function to draw a teapot. But this won't work! Unfortunately, any encapsulated, black-box function for drawing a teapot (or any other object) sends the vertex, normal, and other data as generic vertex attributes. The vertex attribute names are hidden in the black box, and the app shader can't use them.
Seems like there's a few ways to handle this.
1) Punt: glutSolidTeapot remains a black box, and always uses its own shader.
2) Freeglut uses some kind of naming convention, and all shaders used in freeglut apps can access teapot (and other object) vertex attribute data by using hardcoded known names in the shader (like "fgVertex", "fgNormal", etc).
3) A more portable and object-oriented approach is some type of "data object" interface for each object with accessor functions that allow the app to get to the data: glutGetTeapotVerts, glutGetTeapotNormals, etc. This leaves buffer object creation and rendering up to the app.
Thoughts? Have others thought this far down the road yet?
Paul Martz
Skew Matrix Software LLC
+1 303 859 9466