PDA

View Full Version : glRasterPos crashing on openGL 1.5?



Winger
05-28-2005, 07:35 AM
Hi,

We're developing an application in openGL using Visual C++ Builder, and it is crashing on glRasterPos2f/glRasterPos3f functions on never nvidia graphics boards drivers. It looks like this happens with drivers having openGL >= 1.5.
We use glRasterPos to specify location of 2D-text.

Is there any known difference in handling of that function between openGL 1.4 & 1.5?

And what's the solution in this situation?

RigidBody
05-28-2005, 08:07 AM
the solution is- post some code and wait what happens :D

on my linux box i have driver 66.29 running with gl version 1.5.2 on a geforce4 mx440. never had a problem with glRasterPos.

maybe the problem is not glRasterPos itself, but something else. give us a peek into your code to see what might cause the problem.
you could post the code for a small app which uses only the glRasterPos call and nothing else.

by the way: instead of glRasterPos you could use the GL_ARB_window_pos extension with the function glWindowPos2i(x, y). with it you can set the raster position for text output using 2D window coordinates.

Winger
05-28-2005, 09:34 AM
Well, the source of the application itself (rail vehicle simulator) is a number of files, few of which uses glRasterPos just like in this example:

TModelsManager::Init();
WriteLog("Models init OK");
glRasterPos2f(-0.25f, -0.15f);
glPrint("OK.");
SwapBuffers(hDC); // Swap Buffers (Double Buffering)

Or here:

if (Controlled)
{
SetWindowText(hWnd,AnsiString(Controlled->MoverParameters->Name).c_str());
}
else
{
SetWindowText(hWnd,Global::szSceneryFile);
}
glBindTexture(GL_TEXTURE_2D, 0);
glColor4f(1.0f,0.0f,0.0f,1.0f);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-0.50f);
glRasterPos2f(-0.25f, 0.20f);
glPrint(OutText.c_str());
glRasterPos2f(-0.25f, 0.19f);
glPrint(OutText2.c_str());
glRasterPos2f(-0.25f, 0.18f);
glPrint(OutText3.c_str());
glEnable(GL_LIGHTING);
return (true);

Step-by-step running showed that it crashes exactly on the lines with glRasterPos2f functions, and if I comment them out, it works just fine.

I guess I'll have to try that second way, because I really haven't a clue what is wrong here.

RigidBody
05-28-2005, 10:40 AM
i'm still not convinced that the error comes from glRasterPos...what about glPrint? is that a standard OpenGL command? i don't think so, i didn't find it in my gl.h, so i think it's a convenience function made by <somebody>, which could be a reason for the crash. usually i use glUseXFont (i think in win it is wglUseFont) and glCallLists(...) to display the text.

you should try to make a very simple app which- in the OpenGL part- only clears the color buffer and writes some text using glRasterPos and glCallLists.