Glut Problem

André Bleau andre_bleau@hotmail.com
Wed Dec 8 17:33:00 GMT 2010


Klaus Ramstöck wrote:
 
> Dear list,
 
Hi Klaus,
 
> 
> I tried to compile f90gl under a current cygwin. With some grey hair, I
> succeded, but my programs dont start. 
 
"Dont start". What does that mean? Your programs crash? You get an error message? Please be more
explicit.
 
> I analysed the problem an can
> reproduce it with this modified example glut program.
> >From /usr/share/doc/opengl-1.1.0/GLUTexamples/helloGlut.c:
> ----cut
> #include <stdio.h>
> #include <GL/glut.h>
> #include <GL/glutf90.h>
 
What is glutf90.h ? It is not part of the OpenGL package.
 
> 
> ...
> 
> #define GLUTCALLBACKFCB
> typedef void (GLUTCALLBACKFCB *GLUTbuttonBoxFCBUSR) (int *, int *);
> int main(int argc, char* argv[])
> {
> atexit(exit_func);
> glutInit(&argc, argv);
> glutCreateWindow("Hello GLUT!");
> glutDisplayFunc(display_func);
> glutKeyboardFunc(keyboard_func);
> printf("Press any key to toggle color.\n");
> printf("Press Esc to end.\n");
> glutMainLoop();
 
glutMainLoop loops forever (up to program exit). Code after it will never get executed.

> int button, state;
>  ((GLUTbuttonBoxFCBUSR)__glutGetFCB(GLUT_FCB_BUTTON_BOX))(&button, &state);
 
These 2 lines are total nonsense. FCB stands for Fortran CallBack.
 
- Fortran is unsupported by the OpenGL package. I am not interrested in adding that support, 
  but I would accept patches that do.
 
- Even if it was supported, you cannot blindly insert a call to a Fortran function into a C function.
 
- glutGetFCB is called to know the function associated with some callback, in the case above,
  the callback for the button box. You try to call the callback function directly, but you have not
  set such a callback function previously (in C, with glutButtonBoxFunc, in Fortran, presumably with
  glutSetFCB).
 
- I don't think that button boxes are supported on Windows. They were some Silicon Graphics things.
 
- Calling things begining by __glut makes no sense. The functions names in the Glut library begin
  by glut. The linker is responsible for finding the internal name of the corresponding function.

> return 0;
> }
> ----cut
 
> The only relevant difference is this line:
>  ((GLUTbuttonBoxFCBUSR)__glutGetFCB(GLUT_FCB_BUTTON_BOX))(&button, &state)
> 
> Without this line, the program compiles and works as expected.
> It seems there is a mismatch between the definition of __glutGetFCB
> in the .a and in the .dll file.
 
I think your problem is deeper than that. You need to explain what you are trying to do. If you
are trying to port some Fortran program that was meant to run on Silicon Graphics to Windows 
you will have a hard time.
 
> 
> Can anybody confirm this and help me fix it?
> 
> Thank you.
> 
> Klaus
 
André Bleau, Cygwin's OpenGL package maintainer.
Please send any question or comment about the OpenGL package to cygwin at cygwin dot com, 
not directly to me.
  		 	   		  

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list