Hi

I'm attaching a trivial patch for OpenGL bindings that

1. Fixes declarations of glGetMapiv, glGetMaterialiv and glLightiv to take pointer as the last parameter.

2. Changes glGetString, gluErrorString and gluGetString to return PChar instead of PGLubyte. After all, GLubyte and Char are the same thing internally but for Pascal declaration PChar is more comfortable than PGLubyte, since these functions always return null-terminated strings. This is even proved in GLext unit implementation where you have to explicitly cast result of glGetString(GL_EXTENSIONS) to PChar all the time :)

I also submitted these changes to Tom Nuydens and to jedi-sdl (for Delphi/Kylix users that use version of these units from jedi-sdl), so all three copies of these units stay synched.

Michalis
Index: gl.pp
===================================================================
--- gl.pp	(wersja 57)
+++ gl.pp	(kopia robocza)
@@ -1270,15 +1270,15 @@
   glGetLightiv: procedure(light, pname: GLenum; params: PGLint); extdecl;
   glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); extdecl;
   glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); extdecl;
-  glGetMapiv: procedure(target, query: GLenum; v: GLint); extdecl;
+  glGetMapiv: procedure(target, query: GLenum; v: PGLint); extdecl;
   glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); extdecl;
-  glGetMaterialiv: procedure(face, pname: GLenum; params: GLint); extdecl;
+  glGetMaterialiv: procedure(face, pname: GLenum; params: PGLint); extdecl;
   glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); extdecl;
   glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); extdecl;
   glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); extdecl;
   glGetPointerv: procedure(pname: GLenum; params: Pointer); extdecl;
   glGetPolygonStipple: procedure(mask: PGLubyte); extdecl;
-  glGetString: function(name: GLenum): PGLubyte; extdecl;
+  glGetString: function(name: GLenum): PChar; extdecl;
   glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); extdecl;
   glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); extdecl;
   glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); extdecl;
@@ -1314,7 +1314,7 @@
   glLightf: procedure(light, pname: GLenum; param: GLfloat); extdecl;
   glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); extdecl;
   glLighti: procedure(light, pname: GLenum; param: GLint); extdecl;
-  glLightiv: procedure(light, pname: GLenum; const params: GLint); extdecl;
+  glLightiv: procedure(light, pname: GLenum; const params: PGLint); extdecl;
   glLineStipple: procedure(factor: GLint; pattern: GLushort); extdecl;
   glLineWidth: procedure(width: GLfloat); extdecl;
   glListBase: procedure(base: GLuint); extdecl;
Index: glu.pp
===================================================================
--- glu.pp	(wersja 57)
+++ glu.pp	(kopia robocza)
@@ -83,9 +83,9 @@
   PPointer = ^Pointer;
 
 var
-  gluErrorString: function(errCode: GLenum): PGLubyte; extdecl;
+  gluErrorString: function(errCode: GLenum): PChar; extdecl;
   gluErrorUnicodeStringEXT: function(errCode: GLenum): PWideChar; extdecl;
-  gluGetString: function(name: GLenum): PGLubyte; extdecl;
+  gluGetString: function(name: GLenum): PChar; extdecl;
   gluOrtho2D: procedure(left,right, bottom, top: GLdouble); extdecl;
   gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble); extdecl;
   gluPickMatrix: procedure(x, y, width, height: GLdouble; var viewport: TViewPortArray); extdecl;
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to