After installing GeForce 4mx my programs ceased to work

When I call ChoosePixelFormat function, compilation ends abruptly. Maybe someone has already encountered this problem?

The compilation usualy ends on a syntax error. Post the code that generates the error, including the error message itself.

ChoosePixelFormat is a Win32 API function and does not change because you change graphics card. The behaviour of it may, but thats a run time problem, not a compile time.

It ends without any warnings or error messages. The code is form OpenGL12.pas header file:

FillChar(PFDescriptor, SizeOf(PFDescriptor), 0);
with PFDescriptor do
begin
nSize := SizeOf(PFDescriptor);
nVersion := 1;
dwFlags := PFD_SUPPORT_OPENGL;
AType := GetObjectType(DC);
if AType = 0 then
RaiseLastOSError;

if AType in MemoryDCs then
  dwFlags := dwFlags or PFD_DRAW_TO_BITMAP
else
  dwFlags := dwFlags or PFD_DRAW_TO_WINDOW; 
if opDoubleBuffered in Options then
  dwFlags := dwFlags or PFD_DOUBLEBUFFER; 
if opGDI in Options then
  dwFlags := dwFlags or PFD_SUPPORT_GDI; 
if opStereo in Options then
  dwFlags := dwFlags or PFD_STEREO; 
iPixelType := PFD_TYPE_RGBA; 
cColorBits := ColorBits; 
cDepthBits := 32; 
cStencilBits := StencilBits; 
cAccumBits := AccumBits; 
cAuxBuffers := AuxBuffers; 
if Layer = 0 then
  iLayerType := PFD_MAIN_PLANE
else
  if Layer > 0 then
    iLayerType := PFD_OVERLAY_PLANE
  else
    iLayerType := Byte(PFD_UNDERLAY_PLANE); 

end;
if not InitOpenGL then
RaiseLastOSError;
PixelFormat := ChoosePixelFormat(DC, @PFDescriptor); // that’s where it ends
if PixelFormat = 0 then
RaiseLastOSError;

if GetPixelFormat(DC) <> PixelFormat then
begin
if not SetPixelFormat(DC, PixelFormat, @PFDescriptor) then
RaiseLastOSError;
end;

DescribePixelFormat(DC, PixelFormat, SizeOf(PFDescriptor), PFDescriptor);
with PFDescriptor do
if (dwFlags and PFD_NEED_PALETTE) <> 0 then
Palette := SetupPalette(DC, PFDescriptor)
else
Palette := 0;

Result := wglCreateLayerContext(DC, Layer);
if Result = 0 then
RaiseLastOSError
else
LastPixelFormat := 0;
end;

Haven’t done any Pascal in quite a few years, so can’t help much there. To me it seems pretty strange the compiler just stops without reporting why it stopped.

As long as @ means “address of”, or something similar, then I see no error in your code.

By the way, if the compiler doesn’t say anything, how can you know that’s the line where the compilation ends?

I trace it step-by-step

Yes, “@” is address. Thanks anyway

It won’t be ending in there, it’ll be returning zero. You are trying to choose a pixel format that is unsupported, for example too many bits of z + destination alpha + stencil. Try no overlay etc.

Try setting cDepthBits to 1 (this says give me the biggest supported depth buffer) and perhaps do the same with stencil. When chosing a pixel format descriptor you MUST have fallback options so you can reduce the requirements should you fail to get what you ask for, what happens when the hardware doesn’t support what you ask for? Well you found out I suppose.

A better way is to enummerate the pixel formats and choose one which suits you. That way you’re less likely to fail.

[This message has been edited by dorbie (edited 07-03-2002).]

If you can’t compile the program, then how can you trace it step by step? To be able to trace it at all, you must be able to compile it so you can run it.

Are you sure don’t mean it’s a RUN TIME problem, and not a compile time? Cause if you can trace it, you sure must be able to compile it properly.

I agree with Bob that you probably mean a runtime error rather than a compile error. It’s been awhile since I’ve worked with Pascal, but so far as I recall, it isn’t an interpreted language, so it needs to be compiled before it can be run. Maybe I’m wrong about that, though.

Probably you’re right, I’m able to trace it,so it’s a runtime problem. I’ll try what you advised.