earth_walker
12-28-2003, 01:57 PM
Hi! I'm using Delphi5 to do OpenGL programming. The following code is from a book, it have been working, but doesn't work now. Can you help to see how to fix it?
Thank you!
*************************************
procedure TForm1.FormCreate(Sender: TObject);
var
pfd: TPixelFormatDescriptor;
FormatIndex: integer;
begin
......
FormatIndex := ChoosePixelFormat(Canvas.Handle,@pfd);
SetPixelFormat(Canvas.Handle,FormatIndex,@pfd);
GLContext := wglCreateContext(Canvas.Handle);
wglMakeCurrent(Canvas.Handle,GLContext);
ShowMessage('version='+glGetString(GL_VERSION)+';'
+#13+'vendor='+glGetString(GL_VENDOR)+';');
{error checking}
errorCode := glGetError;
if errorCode<>GL_NO_ERROR then
raise Exception.Create('Error in Paint'#13+
gluErrorString(errorCode));
end; {FormCreate}
**********************************
The information given by watching variables:
FormatIndex=1
GLContext=0
errorCode=1282
also, the ShowMessage statement tells that both vendor and version returns empty string.
I remember this program worked in summer this year, but it doesn't work during these couple month, is it possible to because of the update of Windows? I'm under Windows 2000
Result:
Thank you!
*************************************
procedure TForm1.FormCreate(Sender: TObject);
var
pfd: TPixelFormatDescriptor;
FormatIndex: integer;
begin
......
FormatIndex := ChoosePixelFormat(Canvas.Handle,@pfd);
SetPixelFormat(Canvas.Handle,FormatIndex,@pfd);
GLContext := wglCreateContext(Canvas.Handle);
wglMakeCurrent(Canvas.Handle,GLContext);
ShowMessage('version='+glGetString(GL_VERSION)+';'
+#13+'vendor='+glGetString(GL_VENDOR)+';');
{error checking}
errorCode := glGetError;
if errorCode<>GL_NO_ERROR then
raise Exception.Create('Error in Paint'#13+
gluErrorString(errorCode));
end; {FormCreate}
**********************************
The information given by watching variables:
FormatIndex=1
GLContext=0
errorCode=1282
also, the ShowMessage statement tells that both vendor and version returns empty string.
I remember this program worked in summer this year, but it doesn't work during these couple month, is it possible to because of the update of Windows? I'm under Windows 2000
Result: