3D in EFL (Rolling dices on OpenMoko)

Carsten Haitzler (The Rasterman) raster at rasterman.com
Wed Mar 24 14:57:27 CET 2010

On Wed, 24 Mar 2010 11:56:50 +0100 Xavier Cremaschi <omega.xavier at gmail.com>

> Le 24/03/2010 01:22, Carsten Haitzler (The Rasterman) a écrit :
> > On Mon, 22 Mar 2010 10:00:56 +0100
> > Xavier Cremaschi<omega.xavier at gmail.com>said:
> >    
> >> EFL can use opengl for its rendering (not on openmoko, because it seems
> >> we don't have an opengl-es driver). What do you mean by 3d ? Can I
> >> modelize cube, sphere, and do some projective geometry ?
> >>
> >> In elementary I cannot find an equivalent of an opengl context
> >> (QGLWidget in qt4), if someone has an idea ?
> >>      
> > see evas_map stuff - u can apply a "map" (a (texture)map). you define 4
> > points in space (3d), 4 texture u,v co-ordinates (that map the given object
> > geometry to these 4 points - just like opengl). you cat rotate these points
> > around the 3 axes (x, y and z) by  number of degrees and you now can apply
> > a perspective transform + lighting to this map (the 4 points). see expedite
> > or elementary - they use this. the elm flip widget does just this to flip
> > in "3d" between a front and back side of a "card". expedite crates its
> > spinning cubes this way.
> >
> > it's not intended for full "3d" - like making complex 3d apps/games. it's
> > meant for 3d effects in 2d ui's. like spinning, rotating and flipping. it
> > can be used a bit more extensively to do single geometric stuff like cubes
> > - it could do spheres given enough faces made out of multiple objects, but
> > that's pushing it. it could do simple 3d needed for things like
> > mapping/navigation apps.
> >
> > but no - there is no "qglwidget" thing in evas - this imho is "throwing in
> > the towel" and just "do it all in opengl" which is a very different api
> > concept to evas - it means you NEEED opengl or it just doesnt work. evas
> > provides its map feature with or without opengl present. it works (fast) in
> > software as well as opengl. it's an always-on and always-working feature.
> >
> >    
> Thanks for you answer.
> I just need to modelize simple dices I think (d4,6,8,10,12,20... I could 
> see later to add the exotic ones), so if I understand what you wrote and 
> how evas_map works, I need to :
> - use many evas_map to describe a dice (evas_map being 4 points, it's 
> easy for d4...for d6 with 8 vertexes I could use 2 maps)
> - use available rotate functions (and own translate functions) to 
> animate that
> For a d4, something like :
> - Evas_Map *m = evas_map_new(4);
> - I give my four 3d points, using evas_map_point_coord_set(..)
> - I do myself a projection to determine where these points are in the 2d 
> texture (if I want a top view for example)
> - I set these four 2d points with evas_map_point_image_uv_set(..)
> - Now I can use rotate/translate to move the dice
> ?

look at expedite and its cubes - u dont need to do the projection etc. evas has
these for you - move your stuff in 2d space as u please (the 4 point x, y
coords) and set z as u like. u can use the map util funcs to rotate around any
point/axis. you can use the perspective call to do the "projection" (if you
want 3d perspective) and lighting too. if you want. with a point lightsource.
when done u set the map for the obj (well enable it too). you can free it now
as the obj has its own copy of that map - u want to make a new one and modify
it for the next frame/change

------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com

More information about the community mailing list