FLTK logo

Re: how to use glutWire* functions ?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.opengl  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: how to use glutWire* functions ? Albrecht Schlosser Mar 16, 2011  
 
On 15.03.2011 19:40, Greg Ercolano wrote:
> Greg Ercolano wrote:
...
>      I updated the cheat page to show this newer technique
>      for the 'Sphere' example that compiles and runs on both 1.1 and 1.3:
>      http://seriss.com/people/erco/fltk/#OpenGLSphereWithLight
>
>      Had to make some changes to the #include's at the top to ensure
>      it builds and runs correctly on both.
>
>      I couldn't find a combo of #include's that worked for both versions.
>      Ran out of time, and had to make conditional #if's based on FL_MINOR_VERSION
>      to get it to build and run on 1.1 and 1.3.
>
>      This perhaps reveals some (undesirable) incompatibilities.
>
>      If someone can tell me what the correct #includes should be
>      which works for both 1.1 and 1.3 in that example, I'd appreciate it.
>      As it is, the example is now a bit ugly with all those #if conditionals,
>      which seems to show an undesirable FLTK incompatibility between 1.1 and 1.3.

I removed *all* #includes (including math.h) except this one (note also
the upper case 'H'):

#include <FL/glut.H>

and it works with FLTK 1.1 and FLTK 1.3 on Windows and Linux. I didn't
try Mac OS though. Compiled with:

$ ./fltk-config --use-gl --use-glut --compile opengl_sphere.cxx

The docs <http://www.fltk.org/doc-1.1/opengl.html> say:

"You must include FLTK's <FL/gl.h> header file. It will include the
  file <GL/gl.h>, define some extra drawing functions provided by FLTK,
  and include the <windows.h> header file needed by WIN32 applications."

I assume that this also applies to glut, and thus I used FL/glut.H.
This also includes FL/gl.h (lower case 'h').
That's all you need :-)

The "incompatibilities" are probably because you didn't include the
correct header(s) in the old code, and it worked nevertheless.

BTW.: perhaps you could add linker commands (like mine above) to
your cheat page. At least I didn't find one for this example.

Albrecht
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.