View Full Version : 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
nSize := SizeOf(PFDescriptor);
nVersion := 1;
dwFlags := PFD_SUPPORT_OPENGL;
AType := GetObjectType(DC);
if AType = 0 then
if AType in MemoryDCs then
dwFlags := dwFlags or PFD_DRAW_TO_BITMAP
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
if Layer > 0 then
iLayerType := PFD_OVERLAY_PLANE
iLayerType := Byte(PFD_UNDERLAY_PLANE);
if not InitOpenGL then
PixelFormat := ChoosePixelFormat(DC, @PFDescriptor); // that's where it ends
if PixelFormat = 0 then
if GetPixelFormat(DC) <> PixelFormat then
if not SetPixelFormat(DC, PixelFormat, @PFDescriptor) then
DescribePixelFormat(DC, PixelFormat, SizeOf(PFDescriptor), PFDescriptor);
with PFDescriptor do
if (dwFlags and PFD_NEED_PALETTE) <> 0 then
Palette := SetupPalette(DC, PFDescriptor)
Palette := 0;
Result := wglCreateLayerContext(DC, Layer);
if Result = 0 then
LastPixelFormat := 0;
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?
Yes, "@" is address. Thanks anyway
07-03-2002, 03:57 AM
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.
07-03-2002, 08:10 AM
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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.