JRS
JRS

Reputation: 1458

OpenGL raster text disappears behind background

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: https://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.

Upvotes: 0

Views: 1520

Answers (1)

shoosh
shoosh

Reputation: 78934

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...

Upvotes: 4

Related Questions