wxGLCanvas

Peter Marino pwm at esoft.dk
Wed Nov 1 06:37:32 PST 2006


Hi wxALL,

the basics:
-System: gentoo, winxp, osx
-wxWidgets: 2.7.1
-gtk2.0
-Kdevelop, developer studio


I'm trying to get OpenGL working with wxWidgets. My ideal version is to 
get my own render context working. On winxp this was pretty easy I got
the hWnd from the wxWindow and the render context was then created. This 
gives me full control.

The next step was to get it working on Linux (gentoo). I found out 
quickly that I would need a XWindow, but I could find anyway of getting 
that from the wxWindow or through the gtk2.0. My knowledge about linux 
is limited, so it might just be my lack of knowing what to do is what is 
  wrong.

To solve this problem I thought creating a wxGLCanvas and just debugging 
it and single step it and see how it gets the context running would help.

I changed the following:
setup.h.in
changed "wxUSE_OPENGL 1"
changed "wxUSE_GLCANVAS       1"

include/wx/setup_inc.h
changed "wxUSE_GLCANVAS    1"

I'm a little unsure about if it's necessary to changed the 
"include/wx/setup_inc.h",.. but I guess nothing would happen if I did.

created my build directory and did this inside it:
../configure --with-gtk --enable-debug --disable-shared --with-opengl

then the standard "make"

NOTE: everything looks find at this point, got my libraries

In kdevelop I added this to "linker flags (LDFLAGS)" in the project options:
"$(../Linux/wxWidgets/build-debug/wx-config --static --libs gl,core,base)"

and this to the compiler flags (CXXFLAGS):
-O0 -g3  -DwxUSE_GLCANVAS -DTARGET_LINUX 
$(../Linux/wxWidgets/build-debug/wx-config --cxxflags) $(pkg-config 
--cflags gtk+-2.0)

The program compiles just fine, but I get a linker error I just don't 
understand:
g++ -O0 -g3 -DwxUSE_GLCANVAS -DTARGET_LINUX 
-I/home/pwm/Projects/Axiom/Linux/wxWidgets/build-debug/lib/wx/include/gtk2-ansi-debug-static-2.7 
-I/home/pwm/Projects/Axiom/Linux/wxWidgets/include 
-I/home/pwm/Projects/Axiom/Linux/wxWidgets/contrib/include 
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXDEBUG__ -D__WXGTK__ -pthread 
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -pthread -pthread -o Hole HoleApp.o 
HoleMainframe.o stdafx.o 
-L/home/pwm/Projects/Axiom/Linux/wxWidgets/build-debug/lib 
-L/usr/X11R6/lib 
/home/pwm/Projects/Axiom/Linux/wxWidgets/build-debug/lib/libwx_gtk2d_gl-2.7.a 
/home/pwm/Projects/Axiom/Linux/wxWidgets/build-debug/lib/libwx_gtk2d_core-2.7.a 
/home/pwm/Projects/Axiom/Linux/wxWidgets/build-debug/lib/libwx_based-2.7.a 
-L/usr/lib /usr/lib/libGLU.so /usr/lib/opengl/nvidia/lib/libGL.so 
/usr/lib/libSM.so /usr/lib/libICE.so /usr/lib/libXmu.so 
/usr/lib/libXt.so /usr/lib/libXi.so /usr/lib/libgtk-x11-2.0.so 
/usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so 
/usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libpango-1.0.so 
/usr/lib/libgobject-2.0.so /usr/lib/libgmodule-2.0.so 
/usr/lib/libgthread-2.0.so -lpthread /usr/lib/libglib-2.0.so 
/usr/lib/libXinerama.so /usr/lib/libXxf86vm.so /usr/lib/libX11.so 
/usr/lib/libXext.so /usr/lib/libXau.so /usr/lib/libXdmcp.so 
/usr/lib/libpng12.so /usr/lib/libtiff.so /usr/lib/libjpeg.so -lm -lc -lz 
-ldl ../../SigmaWindow/libSigmaWindow.a 
../../SigmaRenderOpenGL/SigmaRenderOpenGLLinux/libSigmaRenderOpenGLLinux.a 
../../SigmaRenderOpenGL/libSigmaRenderOpenGL.a 
../../SigmaRender/libSigmaRender.a ../../SigmaMath/libSigmaMath.a 
../../SigmaUtil/libSigmaUtil.a -Wl,--rpath 
-Wl,/usr/lib/opengl/nvidia/lib -Wl,--rpath -Wl,/usr/lib/opengl/nvidia/lib
../../SigmaWindow/libSigmaWindow.a(SwPanelView.o): In function 
`CSwPanelView::CreateControls()':
/home/pwm/Projects/Axiom/SigmaWindow/SwPanelView.cpp:53: undefined 
reference to `wxGLCanvas::wxGLCanvas(wxWindow*, wxGLCanvas const*, int, 
wxPoint const&, wxSize const&, long, wxString const&, int*, wxPalette 
const&)'
collect2: ld returned 1 exit status

My first thought is the wxWidgets was configure wrong, so I descided to 
try and make one of the samples in my build directory. All the samples 
work just find and are using wxGLCanvas.

so what am I doing wrong?

kind regards,
Peter Marino




More information about the wx-dev mailing list