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 ? Greg Ercolano Mar 16, 2011  
 
Albrecht Schlosser wrote:
>>      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."

	It's scary that including FL/Fl_Window is the wrong thing to do
	when declaring an Fl_Window.. that's what tripped me up with 1.3.

	I didn't feel comfortable using Fl_Window without including it,
	even though it did seem to work in 1.3 without it..

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

	Most likely ;)

	At some point it becomes an issue of 'keep trying stuff until it works',
	as I've found the the docs are often out of date. (I still think like
	a user and not a dev ;)

	Seems we need a good glut example/test program that shows how to mix
	fltk widgets with both opengl and glut, and have the example refer
	to the relevant docs.

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

	Yes, the compile/link instructions are in bold in the code's
	comment header, and recommends using:
	fltk-config --use-glut --compile sphere.cxx

	..which is pretty much what you used, only I didn't include --use-gl
	as I figured --use-glut would do that by default. (seems to)

	I'll try your changes and adjust the example.
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'.