Board index » delphi » OpenGL Routiens missing?

OpenGL Routiens missing?

I can't figure out whawts wrong..

GLUT is supposed to have a routine glutMouseFunc(); however whenever I
compile the program below I get the error :

glufun.pas(70,3) Error: Identifier not found GLUTMOUSEFUNC
glufun.pas(70,24) Error: Illegal expression
glufun.pas(73) Fatal: There were 2 errors compiling module, stopping

{Program I'm Trying to compile.}
Program glFun;
Uses gl, Glut;

const
   spin   : GLfloat = 0.0;

Procedure init;
Begin
   glClearColor (0.0, 0.0, 0.0, 0.0);
   glShadeModel (GL_FLAT);
end;

Procedure display; cdecl;
Begin
   glClear(GL_COLOR_BUFFER_BIT);
   glPushMatrix;
   glRotatef(spin, 0.0, 0.0, 1.0);
   glColor3f(1.0, 1.0, 1.0);
   glRectf(-25.0, -25.0, 25.0, 25.0);
   glPopMatrix;
   glutSwapBuffers;
end;

Procedure SpinDisplay; cdecl;
Begin
   spin := spin + 2.0;
   if (spin > 360.0) then
      spin := spin - 360.0;
   glutPostRedisplay;
end;

Procedure reshape(width, height: longint); cdecl;
Begin
   glViewport (0, 0, GLsizei( width ), GLsizei( height ));
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity;
end;
Procedure Mouse ( button, state, x, y: longint); cdecl;
Begin
   case button of
   GLUT_LEFT_BUTTON:
     Begin
       if (state = GLUT_DOWN) then
          glutIdleFunc(@spinDisplay);
     end;
   GLUT_MIDDLE_BUTTON:
     Begin
       if (state = GLUT_DOWN) then
          glutIdleFunc(Nil);
     end;
   else
     glutIdleFunc(nil);
   end;

end;

Begin
   glutInit(@argc, argv);
   glutInitDisplayMode (GLUT_DOUBLE or GLUT_RGB);
   glutInitWindowSize (250, 250);
   glutInitWindowPosition (100, 100);
   glutCreateWindow( 'GL FUN!');
   init;
   glutDisplayFunc(@display);
   glutReshapeFunc(@reshape);
   glutMouseFunc(@mouse);
   glutMainLoop;
end.

 

Re:OpenGL Routiens missing?


The reason some routiens are missing is because they weren't

implemented (for whatever reason) into glut.pp.

If I understand correctly only 3 lines of code need to be added:

In the Types section Underneath TGlutKeyboardFunc; TGlutMouseFunc will
need to be difined as:

TGlutMouseFunc = procedure ( button, state, x, y: Longint); extdecl

In the variable section under GlutKeyboardFunc a new pointer needs to be
declared as:

glutMouseFunc : procedure (func: TGlutMouseFunc); cdecl;

and in the function InitGLUTFromLibrary under
glutKeyboardFunc := GetProc(libglut, 'glutKeyboardFunc');
a new statment must be inserted as:
glutMouseFunc := GetProc(libglut, 'glutMouseFunc');

I have made these changes to my file and maked and make-installed it
successfully.

If, in the next release of the OpenGL Unit these changes could be
included that would be awsome :))

Re:OpenGL Routiens missing?


On Wed, 11 Jul 2001 02:43:01 GMT, Jon David Sawyer

Quote
<BadQuanta6...@home.com> wrote:
>I can't figure out whawts wrong..

You should say what compiler and libraries you're using.

Quote

>GLUT is supposed to have a routine glutMouseFunc(); however whenever I
>compile the program below I get the error :

>glufun.pas(70,3) Error: Identifier not found GLUTMOUSEFUNC
 ...
>Uses gl, Glut;

Presumably GLUTMOUSEFUNC is supposed to be declared in Glut.pas.  Is
it there or not?  If you're using a shared library of some sort, is
GLUTMOUSEFUNC exported from it?

Duncan Murdoch

Other Threads