views:

369

answers:

1

I am drawing a quad as a background so I can apply a gradient. Details of how I'm doing this are found in a similar question: http://stackoverflow.com/questions/1064840

The 2D raster text (screen text) is drawn as expected without the gradient background. However, when the gradient background is drawn, the text disappears (I'm assuming behind the background quad).

¿ Any ideas ?

I am creating the font by calling

wglUseFontBitmaps HDC, 32, 96, FontID

and the text is drawn using

glRasterPos3d X, Y, Z
glListBase FontID - 32

glPushAttribute GL_LIST_BIT

Dim B() As Byte
B = StrConv(TextString, vbFromUnicode)  
glCallLists Len(TextString), GL_UNSIGNED_BYTE, B(0)

glPopAttribute GL_LIST_BIT

Note that my 3D text is being drawn successfully in all cases using

wglUseFontOutlines HDC, 0, 255, FontID, 0, 0, WGL_FONT_LINES, GMF(0)
  or
wglUseFontOutlines HDC, 0, 255, FontID, 0, 0, WGL_FONT_POLYGONS, GMF(0)

and it's equivalent drawing routines.

Edit: Solved

I was popping a matrix I shouldn't have been popping.

+2  A: 

You should disable the Z-buffer when drawing the text with

glDisable(GL_DEPTH_TEST)

and enable it after you're done with the text with

glEnable(GL_DEPTH_TEST)

Is that OpenGL inside Visual Basic? Absolutely Hideous...

shoosh
Disabling the Z-buffer did not fix the issue. And yes, OpenGL with VB6 is absolutely hideous.
JRS
With no Z-buffer, nothing is going to be behind anything. so it the text is the last thing you draw you should definitely see it. Could you be more specific as to how it fails to work?
shoosh
In my original attempt I reversed glDisable and glEnable. Now that I have correctly followed your suggestion the text appears over the background. However, this is not an optimal solution because now the text always appears, even when it is behind a (non-background) object in my scene.
JRS