Re: [eigen] OpenGL support

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


I like that this is a straightforward enhancement that doesn't prevent e.g. someone who knows GL but not Eigen from understanding code using the adapters. Nice work.

Keir

On Thu, Jul 22, 2010 at 7:45 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:
Hi,

I've just adapted and pushed some old code I had to pass Eigen's
objects to OpenGL, like:

Vector3f a, b;

glVertex(0.5*(a + b));

without having to bother about the dimension, scalar type, whether I
should evaluate the _expression_ or not, degree versus radian, row major
versus column major, etc., etc.

Currently supported functions:

glVertex, glNormal, glColor, glTexCoord (for 2D, 3D, 4D and int,
short, float and double)

glTranslate( a 2D or 3D vector _expression_ )
glScale( a 2D or 3D vector _expression_ )

glRotate( Rotation2D or AngleAxis or Quaternion )

glLoadMatrix( 4x4 _expression_ of float or double which can be row or
column major )
glMultMatrix( 4x4 _expression_ of float or double which can be row or
column major )

Feel free to improve it and send patch ;) (e.g., it would be welcome
to support Eigen::Translation, Eigen::Transform,
Eigen::UniformScaling, 2x2 and 3x3 rotation matrix via glRotate, etc.)

cheers,

gael





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/