I need to add labels to my scene and thought easiest to turn off the programmable pipeline and use GLUT calls. Running into problems I now have two questions:
... regular code
... GLUT text calls
in the drawing routine but it doesn’t work. What might be the problem and what is the correct way to transition
in/out of the programmable pipeline?
(2) What’s the best practice for drawing text in the programmable pipeline?
Thanks in advance.
It might be any number of things; it’s almost impossible to say without more information.
Most of the likely possibilities boil down to forgetting to set up the necessary fixed-function state (e.g. model-view or projection matrices), because it wasn’t relevant when using a shader.
glBitmap() does actually work with shaders, but you can’t use any user-defined variables in the interface between the vertex shader and the fragment shader. glRasterPos() and glWindowPos() invoke the vertex shader, but only store pre-defined variables such as gl_Position, not user-defined variables. Any user-defined variables will be undefined when the fragment shader is invoked by glBitmap(). At least, that’s how it’s supposed to work, although it’s a sufficiently uncommon case that implementation bugs could easily go unnoticed.
If you’re concerned with the core profile rather than with shaders per se, you need to use textured “quads” (i.e. triangle pairs) instead of bitmaps. Or you can use stroke fonts.