FLTK logo

Re: [fltk.general] Re: GLSL

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

Re: Re: GLSL Albrecht Schlosser Aug 28, 2022  
 
On 8/28/22 11:29 holm.h...@gmail.com wrote:
Hi,
Seems like there is a example already under examples/OpenGL3test

I however have problems linking the code under linux:
*** Compile OpenGL3test.cxx...
g++ -I.. -I.. -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -Wall -I. -c OpenGL3test.cxx -o OpenGL3test.o
*** Linking OpenGL3test...
g++ OpenGL3test.o ../lib/libfltk.a -lXrender -lXcursor -lXfixes -lXft -lfontconfig -lXinerama -pthread -lpthread -ldl -lm -lX11 ../lib/libfltk_images.a -ljpeg -lpng -lz ../lib/libfltk.a -lXrender -lXcursor -lXfixes -lXft -lfontconfig -lXinerama -pthread -lpthread -ldl -lm -lX11 -o OpenGL3test
OpenGL3test.o: In function `Fl_Gl_Window::mode(int)':
OpenGL3test.cxx:(.text._ZN12Fl_Gl_Window4modeEi[_ZN12Fl_Gl_Window4modeEi]+0x21): undefined reference to `Fl_Gl_Window::mode(int, int const*)'
OpenGL3test.o: In function `Fl_Gl_Window::pixel_w()':
OpenGL3test.cxx:(.text._ZN12Fl_Gl_Window7pixel_wEv[_ZN12Fl_Gl_Window7pixel_wEv]+0x14): undefined reference to `Fl_Gl_Window::pixels_per_unit()'
OpenGL3test.o: In function `Fl_Gl_Window::pixel_h()':

Any hints ?


Yes, please don't top-post in this group, it's hard to keep the context.
https://en.wikipedia.org/wiki/Posting_style#Top-posting

That aside, how did you compile/build? You are posting the error message(s) but not your command which would have been really helpful.

AFAICT the OpenGL3 demos are not included in configure/make builds. examples/Makefile However, if you build with CMake you get them "for free" (set FLTK_BUILD_EXAMPLES:BOOL=ON).

Finally: try to add "-lGLU -lGL -lGLEW" to your linker command. I tried the following (you may do this as well in your environment, don't forget "--use-gl"):

$ ../fltk-config --use-gl --compile OpenGL3test.cxx
g++ -I.. -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -o 'OpenGL3test' 'OpenGL3test.cxx' ../lib/libfltk_gl.a -lGLU -lGL ../lib/libfltk.a -lXrender -lXcursor -lXfixes -lXft -lfontconfig -lXinerama -pthread -lpthread -ldl -lm -lX11

[error messages removed]

Now copy the commandline and add -lGLEW:

$ g++ -I.. -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -o 'OpenGL3test' 'OpenGL3test.cxx' ../lib/libfltk_gl.a -lGLU -lGL ../lib/libfltk.a -lXrender -lXcursor -lXfixes -lXft -lfontconfig -lXinerama -pthread -lpthread -ldl -lm -lX11 -lGLEW
$

This worked for me. YMMV.

Note: my build includes Cairo and more, your command may be much shorter.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/fbd65942-fbc6-5f4d-1447-76b8cd9d8a3c%40online.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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