OpenGL canvas behavior with 2.9.1, OSX 10.6/cocoa 64bit Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
tedzini
Knows some wx things
Knows some wx things
Posts: 34
Joined: Tue Apr 20, 2010 2:30 pm

OpenGL canvas behavior with 2.9.1, OSX 10.6/cocoa 64bit

Post by tedzini » Tue Jan 04, 2011 11:28 pm

Greetings,

I am in the midst of porting my Win32-based app to MAC OSX 10.6.x. There are a couple of glitches that I need to track down. The app uses a canvas with OpenGL context. The viewport is now shifted by a few pixels that appear to be equivalent to the 3D boarder width around the canvas. To be more clear, the viewport is shifted a few pixels downward, and to the left.

I compiled an x86,64bit cocoa build for 10.6.

Has anyone experienced anything like that? Should I build on-top of carbon instead?

thanks,
Ted

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Wed Jan 05, 2011 12:16 am

Hi,

I guess it depends on whether you need 64-bits support. If you don't need 64 bits (and remember, 32 bits binaries run just fine on 64-bits macs), then carbon is recommended for now simply because wxOSX/Carbon is rather stable, while wxOSX/Cocoa is in its fancy and is not quite complete yet
"Keyboard not detected. Press F1 to continue"
-- Windows

tedzini
Knows some wx things
Knows some wx things
Posts: 34
Joined: Tue Apr 20, 2010 2:30 pm

Post by tedzini » Fri Jan 07, 2011 4:14 am

OK, in that case I decided to try supporting 10.5. I need to enable openGL support. I tried this:

arch_flags = "arch i386"
./configure -with-osx_carbon --disable-shared --disable-compat24 --enable-unicode --enable-universal-binary --with-opengl --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk --with-macosx-version-min=10.5 CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"

and this:

./configure -with-osx_carbon --disable-shared --disable-compat24 --enable-unicode --enable-universal-binary --enable-opengl --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk --with-macosx-version-min=10.5 CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"

Neither configs indicate OpenGL support = no in both cases. Can someone supply me with the correct ./configure parameters?

thanks,

t

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Fri Jan 07, 2011 4:35 pm

The flag is named "--with-opengl", not "--enable-opengl"

Also, it is recommended to create a build dir, and invoke ../configure from there - this is cleaner since each build has its files separated. Invoking configure several times in the same directory can result in confused build files
"Keyboard not detected. Press F1 to continue"
-- Windows

tedzini
Knows some wx things
Knows some wx things
Posts: 34
Joined: Tue Apr 20, 2010 2:30 pm

Post by tedzini » Fri Jan 07, 2011 11:09 pm

..In the first config I did try "--with-opengl" and openGL support was still disabled. I'll create a new dir and see if that makes a difference.

thanks very much for the quick reply!

t

tedzini
Knows some wx things
Knows some wx things
Posts: 34
Joined: Tue Apr 20, 2010 2:30 pm

Post by tedzini » Mon Jan 10, 2011 4:26 am

Well, I built it anyway, and the samples OpenGL apps compiled linked and ran normally (with OSX 10.5 SDK/gcc 4.2).

However, with my own app (through Xcode 3.2) I'm getting unresolved OpenGL functions when linking. Here's the ld command, followed by the external errors in build output. I don't want to hijack my own thread-- but is this a linker error or still something that I could have overlooked in the ../configure script (by the way, I started with a clean wx2.9.1 build directory-- just to make sure nothing was getting crossed up) ??:

Xcode 3.2 generated link line:

<snip>
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/tmorris/TruckWatch/build/Release -L/Users/tmorris/TruckWatch/../wxWidgets-2.9.1-orig/librelease -F/Users/tmorris/TruckWatch/build/Release "-F/Users/tmorris/TruckWatch/../OpenSceneGraph-2.8.3/Xcode/OpenSceneGraph/build/Release 32bit Carbon" -filelist /Users/tmorris/TruckWatch/build/TruckWatch.build/Release/TruckWatch.build/Objects-normal/i386/TruckWatch.LinkFileList -mmacosx-version-min=10.5 -framework OpenThreads -framework osg -framework osgAnimation -framework osgDB -framework osgFX -framework osgGA -framework osgIntrospection -framework osgManipulator -framework osgParticle -framework osgShadow -framework osgSim -framework osgTerrain -framework osgText -framework osgUtil -framework osgViewer -framework osgVolume -lwx_baseu_net-2.9 -lwx_baseu_xml-2.9 -lwx_baseu-2.9 -lwx_osx_carbonu_adv-2.9 -lwx_osx_carbonu_aui-2.9 -lwx_osx_carbonu_core-2.9 -lwx_osx_carbonu_gl-2.9 -lwx_osx_carbonu_html-2.9 -lwx_osx_carbonu_media-2.9 -lwx_osx_carbonu_propgrid-2.9 -lwx_osx_carbonu_qa-2.9 -lwx_osx_carbonu_ribbon-2.9 -lwx_osx_carbonu_richtext-2.9 -lwx_osx_carbonu_stc-2.9 -lwx_osx_carbonu_xrc-2.9 -lwxjpeg-2.9 -lwxpng-2.9 -lwxregexu-2.9 -lwxscintilla-2.9 -lwxtiff-2.9 -framework AudioToolbox -framework Carbon -framework IOKit -framework OpenGL -framework QuickTime -framework WebKit -liconv -lm -lz -framework Cocoa -o /Users/tmorris/TruckWatch/build/Release/TruckWatch.app/Contents/MacOS/TruckWatch

<snip>

AND THE BUILD RESULT OUTPUT FROM LD (note that OpenGL.framework included in linker above):

<snip>
"_aglSetCurrentContext", referenced from:
WXGLSetCurrentContext(__AGLContextRec*) in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)

"_aglCreateContext", referenced from:
WXGLCreateContext(__AGLPixelFormatRec*, __AGLContextRec*) in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)

"_aglEnable", referenced from:
wxGLCanvas::SetViewport() in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglDestroyContext", referenced from:
WXGLDestroyContext(__AGLContextRec*) in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglSetDrawable", referenced from:
wxGLContext::SetCurrent(wxGLCanvas const&) constin libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


wxGLCanvas::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int const*, wxPalette const&)in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglSwapBuffers", referenced from:
wxGLCanvas::SwapBuffers() in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglGetError", referenced from:
wxLogAGLError(char const*)in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglGetCurrentContext", referenced from:
WXGLGetCurrentContext() in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglUpdateContext", referenced from:
wxGLCanvas::SetViewport() in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglErrorString", referenced from:
wxLogAGLError(char const*)in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglSetInteger", referenced from:
wxGLCanvas::SetViewport() in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


wxGLContext::SetCurrent(wxGLCanvas const&) constin libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


wxGLCanvas::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&, int const*, wxPalette const&)in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglDestroyPixelFormat", referenced from:
WXGLDestroyPixelFormat(__AGLPixelFormatRec*) in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)


"_aglChoosePixelFormat", referenced from:
WXGLChoosePixelFormat(int const*)in libwx_osx_carbonu_gl-2.9.a(gllib_carbon_glcanvas.o)

ld: symbol(s) not found

collect2: ld returned 1 exit status

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Mon Jan 10, 2011 1:36 pm

Add the framework "AGL" to your link flags.
"Keyboard not detected. Press F1 to continue"
-- Windows

tedzini
Knows some wx things
Knows some wx things
Posts: 34
Joined: Tue Apr 20, 2010 2:30 pm

Post by tedzini » Mon Jan 10, 2011 6:42 pm

greetings --

well that fixed those bugs -- thanks! just curious why I didn't need that one for cocoa 64bit , but maybe that is a 'long answer'.

I will accept the post as 'solved'

thnx,
T

Post Reply