View Full Version : Crash on glVertex2f

04-18-2011, 08:54 AM

A small number of users with XP machines report that an app I am developing crashes on startup in the following way:

1) An OpenGL context is successfully created, via wglCreateContext
2) The app makes a few OpenGL calls to set up the context (glEnable etc).
3) Then, at the very first call to glVertex2f, the app suddenly exits (no error window is displayed)

I believe that this is graphics card related, because the app runs fine with a software OpenGL context, even on the affected machines. Incidentally. one such affected machine has a 128MB Geforce FX Go5700.

If anybody could provide some insight into how to cure this, or to why this happens, or to steps I might take in diagnosing this further, I would be very grateful.

Thank you

04-18-2011, 09:01 AM
Start by getting some information on the context created with glGetString (GL_VENDOR, GL_VERSION, GL_RENDERER, etc) - see google for more.

Try replacing the draw code with a simple glClearColor (..), glclear (GL_COLOR_BUFFER_BIT), glfinish and swap buffers to see where it pops.

04-18-2011, 09:37 AM
Thank you for this response.

I simplified the rendering code to just the following :

if wglGetCurrentContext<>ctx then
end if


glViewport 0,0,width,height



glClearColor 1,0,0,1
glColor3f 1,1,1

SwapBuffers dc

The above code does not crash, and I see the context rectangle filled in red as expected.

Adding the following lines of code before 'glFlush' is sufficient to cause the crash on the machine in question:
glColor4f 0,0,1,1
glVertex2f 100,100
glVertex2f 100,200
glVertex2f 200,200
glVertex2f 200,100

The values returned from glGetString were:
GL_VENDOR : NVIDIA Corporation
GL_VERSION : 1.4.1

04-18-2011, 10:36 AM
Have you tried to updated the drivers?

"GL_VERSION : 1.4.1" is surprizing, your graphics card supports OpenGL 2.0 I think.

04-18-2011, 11:02 AM
FX cards are SM 2.0+ compatible. They came to marketplace at the time of GL 1.4, so it perfectly matches driver version. Although they can execute shaders, their ability is quite restricted. I really doubt it is GL 2.0 complaint. For example, GLSL 1.10.59 defines loops, which are not allowed in SM 2.0. In any case, it is not a bad idea to try to update drivers.

04-18-2011, 12:58 PM
I'm reasonably certain that I remember seeing a reported GL_VERSION of 2.0 the last time I actually used a GeForce FX, but that was some years ago. Definitely sounds like a driver issue though.

Interesting question: have you tried replacing your glVertex2f (x, y) calls with glVertex3f (x, y, 0) calls? This is more or less all that glVertex2f does (or at least should be doing) behind the scenes, and might help to isolate problems.

What I'm currently suspecting is that the machines in question might have a mini-driver of some description installed - like the old 3DFX Quake mini-drivers. There's no such mini-driver that I'm personally aware of, but the symptoms do match the case of a driver that only exports a subset of OpenGL. Maybe check for a rogue opengl32.dll (one that's not that provided by Microsoft) in the program directory (may need to turn on view hidden files) or elsewhere in the path.

04-19-2011, 12:57 AM
Maybe they are doing it in software, but my FX 1400 (I know it is quite old) claims to do OpenGL 2.

Vendor: NVIDIA Corporation
Renderer: Quadro FX 1400/PCI/SSE2
Version: 2.1.2

04-19-2011, 01:34 AM
Sorry for misunderstanding!
I thought about GeForce FX series. Quadro FX is totally another story.
Quadro FX 1400 (based on NV41) is newer card than GeForce FX 5xxx (based on NV30+), and it fully supports SM 3.0, and hence GL 2.0.

04-19-2011, 03:04 AM
Thank you for these replies. I plan to update the driver to the latest, although I am delaying this as long as possible in the hope that I can also make the app compatible with the installed version of the driver.

Interesting idea about glVertex3f - I may try this if I have the chance; the machine I had access to was via remote desktop.

However, after more testing, I have found that the issue is cured when I remove my app's dependency on a particular third party .dll which my app uses, although the function of this .dll is not OpenGL related.

So I have a partial solution, although I would still be very interested to find out how the presence of an unrelated .dll would break glVertex2f on a handful of systems (the one I have tested, and several more reports from users which show the same symptoms).

04-19-2011, 05:30 AM
It was an useful hint that you have accessed target machine through remote desktop! On Windows, only GL 1.1 is available through remote desktop. Does the problem persists if you start application locally?

04-19-2011, 05:52 AM
It would be interesting to know what the DLL is.

04-19-2011, 07:51 AM
> It was an useful hint that you have accessed target machine through remote desktop! On Windows, only GL 1.1 is available through remote desktop. Does the problem persists if you start application locally?

Maybe 'remote desktop' was to wrong term - I was using a web-based software (similar to gotomeeting) to allow me to control mouse and keyboard on a remote machine (as that is the only access I have to a machine exhibiting this behaviour).

Anyway, the problem occurs starting locally on the machine.