Building OpenGL from source
jose isaias cabrera
jicman@cinops.xerox.com
Tue Jun 7 19:43:00 GMT 2005
show-off! :-)
Just kidding. :-) I wish you well and let us know how that goes.
jic
----- Original Message -----
From: "Zieg, Mark" <mark.zieg@lmco.com>
To: <cygwin-xfree@cygwin.com>
Sent: Tuesday, June 07, 2005 3:30 PM
Subject: Building OpenGL from source
> Hello,
>
> Pardon if this is an easy one, but I've been looking at it for a few
> days and haven't found an "easy" solution. If anyone can issue me a few
> adroit pointers (or kicks), I'd be most grateful.
>
> PROBLEM
> -------
>
> I need to be able to build and run an OpenGL implementation from source
> on Windows. Performance isn't an issue, so it doesn't need to have any
> hardware acceleration, but I need to be able to tweak specific equations
> and constants within the source code.
>
> OBSERVATIONS
> ------------
>
> It looks like the default Cygwin OpenGL libraries are basically just
> pass-throughs to the pre-compiled Microsoft implementation; is that
> correct? Since MS probably isn't about to open up the source to their
> version, I went looking for open-source implementations. SGI's
> ogl-sample and the Mesa3D version both looked promising; perhaps
> Chromium if neither of those pan out.
>
> However, I'm finding it's "easier said than done" to get one of those
> compiling and linked into Cygwin's X11R6 installation. For instance,
> Mesa3D doesn't seem to come with a "cygwin" configuration. I hacked one
> from the provided "linux-static" version and was able to compile, but
> the teapot demo coredumps on its first(?) call to glGetString:
>
> LOG INFO : teapot: Teapot V1.2
> LOG INFO : teapot: Written by David Bucciarelli (tech.hmw@plus.it)
> LOG INFO : teapot: calling glutInit...
> LOG INFO : teapot: calling inittextures...
> LOG TRACE : inittextures: [entering]
> LOG INFO : inittextures: glGenTextures...
> LOG INFO : inittextures: glBindTexture...
> LOG INFO : inittextures: glPixelStorei...
> LOG INFO : inittextures: LoadRGBMipmaps...
> LOG TRACE : LoadRGBMipmaps: [entering]
> LOG TRACE : LoadRGBMipmaps2: [entering]
> LOG INFO : LoadRGBMipmaps2: calling tkRGBImageLoad:
> ../images/tile.rgb
> LOG TRACE : tkRGBImageLoad: [entering]
> LOG TRACE : tkRGBImageLoad: [returning]
> LOG INFO : LoadRGBMipmaps2: checking that image was
> returned
> LOG INFO : LoadRGBMipmaps2: determining format from
> number of components
> LOG INFO : LoadRGBMipmaps2: looks like RGB
> LOG INFO : LoadRGBMipmaps2: calling gluBuild2DMipmaps
> LOG INFO : gluBuild2DMipmaps: calling closestFit...
> LOG INFO : closestFit: start
> LOG INFO : closestFit: calling
> glGetString(GL_VERSION)
> Segmentation fault (core dumped)
>
> I wasn't sure where that was coming from, so I temporarily set that path
> aside and tried looking at the SGI ogl-sample build instructions. It
> seemed to state that, like it or not, I was probably going to have to
> build X11 from scratch if I wanted to change OpenGL implementations.
>
> So then I took a full CVS checkout of Xorg (per
> http://x.cygwin.com/docs/cg/prog-obtaining-source.html) and built it.
> That went surprisingly smooth (great job, maintainers!), but all my
> teapot examples still seemed to want to link against
> /usr/lib/w32api/*32.a, which I gather are not touched by the Xorg
> installation. I tried pointing my teapot app to /usr/X11R6/lib, which
> has these intriguingly named libraries:
>
> libGL-1.dll.a
> libGL.dll.a
> libGLU-1.dll.a
> libGLU.dll.a
> libGLw.a
>
> However, trying to link against those spat out lots of undefined
> references:
>
> make[1]: Entering directory `/home/ziegm/opengl/teapot'
> g++ teapot.o -L/usr/X11R6/lib -lglut -lGLU -lGL -o teapot
> teapot.o:teapot.cpp:(.text+0xd2): undefined reference to
> `_glClearColor@16'
> teapot.o:teapot.cpp:(.text+0xe1): undefined reference to
> `_glShadeModel@4'
> teapot.o:teapot.cpp:(.text+0x11d): undefined reference to
> `_glMaterialfv@12'
> teapot.o:teapot.cpp:(.text+0x159): undefined reference to
> `_glLightfv@12'
> teapot.o:teapot.cpp:(.text+0x1fe): undefined reference to
> `_glEnable@4'
> teapot.o:teapot.cpp:(.text+0x27c): undefined reference to
> `_gluLookAt@72'
> ...etc
>
> My assumption (!) from those results is that the full Xorg build is
> still "noticing" that I'm on Cygwin/Windows, and is therefore
> "helpfully" linking its own code against the w32api/MS libraries. (I
> really don't understand enough about this process to confirm or refute
> that theory, however.)
>
> However, I do see that the Mesa code shipped with Xorg under "extras" is
> indeed being compiled and linked into an "libOSMesa.dll.a" archive.
> However, linking against that didn't resolve any of the above linker
> errors. To try to confirm whether these files were even being used, I
> added a bunch of "printf's" to extras/Mesa/src/mesa/*/*light.c
> (apparently symlinked to lib/GL/mesa and programs/Xserver/GL/mesa), yet
> running teapot (linked against /usr/lib/w32api) generated nary a
> message.
>
> Am I even on the right track? Is there an easier way to do this? If
> you needed to intercept and customize a few specific OpenGL functions
> (say, the lighting model), under Windows, preferably via Cygwin, how
> would you go about it?
>
> Thank you for any help you may provide,
>
> Mark Zieg
>
>
More information about the Cygwin-xfree
mailing list