PDA

View Full Version : Exception error in visual C++, in debug mode



Vliegenthart
11-30-2002, 02:17 AM
What can I do witch the follow error?

first-change exception in modal5_opengl_serv.exe (GDI32.DLL): 0xc0000005:Access Violation

This happens with the follow stack in debug mode.
GDI32! bff24dd5()
KERNEL32! bff958f8()
GDI32! bff2789d()
KERNEL32! bff958f8()
CView3d::SetWindowPixelFormat(int 0) line 87 + 76 bytes

When I start the program without Visual C++, then I have no errors or exceptions.
Other sample programs with Opengl also give GDI32.dll problems. In my program I used multiply views.

Computer configuration:
Asus motherboard CUV4X,PC133, P3, 733 Mhz
Geforce2 card,256 DDR, 4xAGP, V6600/6800
NVIdia drivers 40.72
Visual C++ version 6.0,+ service package 5.0
Windows 98.


I have update al myn drivers for the grapic card, windows98, asus BIOS and ASUS mother board, but the problem is not solved
But I don't know of this is a problem from NVidia drivers or in Visual C or OpenGL?

Please what can I do???

Coriolis
11-30-2002, 08:38 AM
Just a guess from the call stack, but are you trying to set pixel format to 0? Pixel format indices are 1-based.

Also, first chance exception is sometimes just a debug breakpoint.

Vliegenthart
12-01-2002, 03:19 AM
Thanks for you reaction.

But, I get this error also from an example of MSDN :msdn\periodic\4955\MODELVIEW.DSW
This example used Opengl at an very easy way:

BOOL COpenGLView::SetupPixelFormat(){
static PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
16, // 16-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
16, // 16-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
if ( 0 == (m_PixelFormat = ::ChoosePixelFormat(m_pDC->GetSafeHdc(), &pfd)) )
{return FALSE;}
if ( FALSE == ::SetPixelFormat(m_pDC->GetSafeHdc(), m_PixelFormat, &pfd) )
{return FALSE;}
return TRUE;
}


The error is coming always at choosePixelformat when I start in step-debugging.
I used screen settings: 1152x864 with 16bits colors. In this example there are used one view.
Always starts the program good for the first time, but I get always exceptions for the second time, or the thread
from opengl was killed with -1 as return and also my own program stops with -1.

It is then also not possible to start the program without debugger. (I get an error: illigal instruction....
and windows works not correctly.) When I press 'OK' at this error , the same error message is also comming up.
When I repeat this ~30 times the program start as well.

Nick Nougat
12-01-2002, 12:44 PM
I have the same problem quite often. It's not a constant though. It seems that debugging GL has some bugs. My programs often simply quit without any exception or error message given but simply stop at SetPixelFormat. Mostly it works running in debug mode for the first time, then starting the program in debug mode again crashes.
Running without debugger will then assign the Software driver after some massive protection fault bombing. My wild guess is that sometimes dll resources are not correctly freed, but not on a reliable basis...

If anyone knows anything to catch / prevent this I'd be glad.

Nick