Perhaps this question has already been asked in this forum, but I have searched the posts for a specific answer to my question and have not found it. I apologize if I am repeating a question.
I am trying to render text in screen coordinates using that texture+quad writing trick. More specifically I am trying to run the code included in the Game Programming Gems I book to render an FPS counter on the screen. It says there that all the OpenGL setup and cleanup code is included in the class, so I figured it would work easily.
Nevertheless, when I try to render text using that code, I get a strip of solid quads in the place where I expected the text to be rendered.
It seems to me that this is a texture and/or blending problem, because the texture is initialized using a GL_LUMINANCE_ALPHA encoding. Perhaps I am doing something that I should not be doing in the setup of my OpenGL environment.
I have stripped down my code to only the very basic initialization calls and I still get the problem.
I am using the glut API to structure my program with the folling code:
initDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ALPHA);
initWindowPosition(20,20);
initWindowSize(800,600);
currentWindow = createWindow(“My Window”);
And setting up OpenGL with the folling code:
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_SMOOTH);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
In the display function, the only call that is made before I try to render the text is this one:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
I’d greatly appreciate if anyone could give me a hint to what I might be doing wrong here.
Thanks