we have some nice opengl visualisation, that only works on linux, but
I would like to make it work with Sage and on all platforms.
So I first thought I would rewrite it in pyglet, that works everywhere
(I tested a prototype already and it indeed works). However, pyglet is
not easy to fix for offscreen rendering, which is one of my
requirements, so that it can run on the notebook server.
Mesa is an implementation of opengl, here is a spkg package:
http://femhub.googlecode.com/files/mesa-7.4.4.p3.spkg, it builds
without any problems on all platforms (32bit, 64bit, linux, Mac). So I
just wrapped a few mesa commands here:
http://github.com/certik/osmesa
and made it work with offscreen rendering, and it just works, both on
linux and Mac (in Sage) in produces "a.pnm" with an image rendered
using opengl. So I am positive that I can get the job done using this
approach. I have to ditch pyglet, but that's life (if it doesn't work
offscreen, then it's useless).
So why I am asking here. :) I am baffled why pyglet uses this library
on Mac: "AGL_H =
'/System/Library/Frameworks/AGL.framework/Headers/agl.h'. Is it
because this library is on Mac by default, so pyglet tries to use it,
so that users don't have to install anything? However, if I install
mesa (which I do anyways), then I don't need it?
Or could it be that if I install mesa on Mac, I never get hardware
acceleration, while if I use agl, I get it?
If I install mesa on linux, do I get hardware acceleration? Do I need
to enable it somehow? It works fast enough on my laptop, but I don't
know if it's software rendering or hardware one.
Many thanks for any feedback,
Ondrej
>
> Hi,
>
> we have some nice opengl visualisation, that only works on linux, but
> I would like to make it work with Sage and on all platforms.
>
> So I first thought I would rewrite it in pyglet, that works everywhere
> (I tested a prototype already and it indeed works). However, pyglet is
> not easy to fix for offscreen rendering, which is one of my
> requirements, so that it can run on the notebook server.
>
> Mesa is an implementation of opengl, here is a spkg package:
> http://femhub.googlecode.com/files/mesa-7.4.4.p3.spkg, it builds
> without any problems on all platforms (32bit, 64bit, linux, Mac). So I
> just wrapped a few mesa commands here:
>
> http://github.com/certik/osmesa
>
> and made it work with offscreen rendering, and it just works, both on
> linux and Mac (in Sage) in produces "a.pnm" with an image rendered
> using opengl. So I am positive that I can get the job done using this
> approach. I have to ditch pyglet, but that's life (if it doesn't work
> offscreen, then it's useless).
>
> So why I am asking here. :) I am baffled why pyglet uses this library
> on Mac: "AGL_H =
> '/System/Library/Frameworks/AGL.framework/Headers/agl.h'. Is it
> because this library is on Mac by default, so pyglet tries to use it,
> so that users don't have to install anything? However, if I install
> mesa (which I do anyways), then I don't need it?
>
Apple's OpenGL documentation is all available at:
http://developer.apple.com/graphicsimaging/opengl/
AGL is a link to the Apple Graphics Library which is used in Carbon
programs doing OpenGL.
Apple has sample GLUT code, I don't know if one includes off-screen
rendering. The main docs discuss off-screen rendering using AGL
and CGL (the latter is used in Cocoa programs).
> Or could it be that if I install mesa on Mac, I never get hardware
> acceleration, while if I use agl, I get it?
>
If you use Mesa, I doubt you'll get hardware acceleration on the Mac,
but you'd have to check the Mesa documentation.
> If I install mesa on linux, do I get hardware acceleration? Do I need
> to enable it somehow? It works fast enough on my laptop, but I don't
> know if it's software rendering or hardware one.
In the past, it was purely software, I don't know if that is true
anymore.
I hope this helps somewhat. To get the sample code, you may need a
free ADC developer account.
Cheers,
Tim.
---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey