PDA

View Full Version : After installing GeForce 4mx my programs ceased to work



07-01-2002, 04:18 AM
When I call ChoosePixelFormat function, compilation ends abruptly. Maybe someone has already encountered this problem?

Bob
07-01-2002, 04:25 AM
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.

07-01-2002, 10:06 AM
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;

Bob
07-02-2002, 02:40 AM
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?

07-02-2002, 09:18 PM
I trace it step-by-step

07-02-2002, 09:21 PM
Yes, "@" is address. Thanks anyway

dorbie
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).]

Bob
07-03-2002, 08:04 AM
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.

Deiussum
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.

07-04-2002, 09:51 AM
Probably you're right, I'm able to trace it,so it's a runtime problem. I'll try what you advised.