DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2590
Version: 2.0-current
I chose "specific to an operating system" as scope, because i've only
tested it with Linux. Perhaps you would encounter the same issue with
MS-Windows or MacOS-X.
When you use specifics Glut functions, that is not present in
libfltk2_glut.so, you get an error message from freeglut.
For example, you would use "glutWireSphere", which is present only in
freeglut.so.
"freeglut ERROR: Function <glutWireSphere> called without first
calling 'glutInit'."
Others glut functions are usable, as long as they belong to
libfltk2_glut.so .
For example, we can use glutSwapBuffers() with no problems.
Attached, you will find a complete sample which put a glut subwindow into
a fltk window. Then, it attempts to draw a sphere with "glutWireSphere".
The compilation & linking are ok. It crashes at execution, with freeglut
complaining about "glutInit" which has to be called first (fltk should do
it for me, but it doesn't change anything if i add the "glutInit()" call
in my code).
I've followed the recommandations of the documentation:
- I put the win.show() before the glut's subwindow creation.
- I add "-lglut" at the very end of the linking libraries evaluation.
- The programm runs properly if you comment "glutWireSphere" call.
The following source file was compiled using:
g++ glut_subwindow.cxx -lfltk2 -lfltk2_gl -lfltk2_glut -lGL -lglut
Link: http://www.fltk.org/str.php?L2590
Version: 2.0-current
/*
Using FLTK with a GLUT Window embedded into FLTK Window
g++ glut_subwindow.cxx -lfltk2 -lfltk2_gl -lfltk2_glut -lGL -lglut
*/
#include <fltk/DoubleBufferWindow.h>
#include <fltk/run.h>
#include <fltk/glut.h>
void glut_timerCB(int id_timer)
{
glutPostRedisplay();
glutTimerFunc(20, glut_timerCB, id_timer);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutWireSphere(0.7,10,10);
glutSwapBuffers();
}
int main(int argc, char **argv)
{
fltk::DoubleBufferWindow win(640, 480, "glut test");
win.show(); // glut will die unless parent window
win.begin(); // this will cause Glut windows to be a child
//With and without glutInit, we will get:
//freeglut ERROR: Function <glutWireSphere> called without first calling
'glutInit'
glutInit(&argc,argv);
glutInitWindowSize(win.w()-20, win.h()-20);
glutInitWindowPosition(10,10);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutCreateWindow("glut embedded window");
win.end();
glutDisplayFunc(display);
glutTimerFunc(20,glut_timerCB,1);
fltk::run();
return 0;
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs