Amaya Opengl Developpement
Amaya Concepts :
- Libwww is the module that get the file by network or on disks.
- We use the Expat parser to fill our structure in local memory, called
the Abstract Image.
- From this structure, we aproximatively compute the visible area, and
then fills the Concrete Image with onnly this portion.
- Concrete Image does some heavy formatting on Concrete Image.
- In order to draw on the canvas, Amaya draws boxes. Each box is a leaf,
from the tree structure of the document. Each leaf has type : Text, Math,
Graphics, Images.
From 2 to 5, this is done by the Thotlib module
For more details on source arragements, take a look at directories
explanation here
Code :
Specific Code of the Amaya Opengl Developpement (Click on download of the
latest version to see code) :
Why not an opengl plugin ? Why an entire opengl canvas ?
see herefor a
short abstract on a presentation on the subject for the svg-open conference
Useful Links :
Scalable Vector Graphics
Edition guidelines
Why Opengl ?
First of all, a good way to see the Opengl capabilities to render SVG, is
to try the demo of ARTSTREAM under Linux, a vector drawing software based on
opengl. (It gives more control than illustrator on certain points : see here
for a french graphist advice on it ) The only conclusion is : Too bad It
doesn't export SVG.
It convinced me of opengl Applicability, so I've tried to find a solution
for every element of the SVG DTD, in order to be sure that all can be done in
SVG. So, here's some of my quicks answer to SVG requirements :
- All primitives (native or by tesselation) can be easily coded with
opengl.
- All basic transformations are totally native.
- Gradients, patterns are much more powerful in opengl, because of per
vertex coloring and advanced texture handling. Stroke an be done with
playing with "GL_LINE_STIPPLE" that can be applied on every geometric
primitives drawn with Vertex, as you can see in the sample "lines" from
the redbook : http://trant.sgi.com/opengl/examples/examples.html.
- Filters are a composed by a continuation of effects applied on a
particular state of an element, so in opengl, it's a continuation of
"pushmatrix", "popmatrix" with transformations applied to each level.
(Each leve of depth of a matrix gives you a new context, with local
coordinates and local transformations.) This interface is well suited for
the SVG rendering pipeline.Clipping, Masking, Fe (light, colormatrix,
blend) are directly given by opengl functionnality. The Demo communauty
has done many great effects that can be a good inpiration
(http://romka.demonews.com/index_eng.htm).
- In the few case of not being able to make a part of SVG in opengl, we
can make it with our own 2D code, and then transpose it on the opengl
Canvas easily : As it's a 2d canvas, all SVG objects are planar objects,
so we can produce a texture that can be mapped on a 2d object, and it
makes an opengl rendered objects, on which we can apply all accelerated
opengl transformations
But the BIG issue is SVG animation : Vector calculations in combination of
multilple realtime effects demands really heavy calculations. SVG animation
demands animation with differents level of context and time, that can be
encapsulated, all in a declarative way, with every SVG element... It's
demands of defining specific optimized structures, buffers, transformations,
cpu-call-handling, easy switching to lower the quality, high level
mathematics optimisation. And If we can have hardware acceleration, we must
do what we can to use it. Otherwise SVG animation won't make any sens before
a long time, and SVG diffusion will suffer from it. Others solution exists,
mainly software libraries, but none give hardware acceleration on so many
platforms..
So what makes me thinking of opengl as the best solution to render SVG is
:
Nearly fifteen years of experience in making animated graphics. Smooth
Vector Animation Robust and very clean code.
- Very Good documentation.
- Huge communauty support.
- Very well supported by the industry (hardware & software), with
good reactivity and evolution process (The opengl Extension
mechanism)
- Exists on merely every OS... (even palmos has a tinyGL and nvidia plans
to delivers opengl accelerated cards for pocket PCs, windows CE will have
an opengl...)
- X3D coding&integration will also be easier with Opengl...
- Multi platform code, very protable, so Amaya Opengl canvas is very
porable on other platfrom, and other laguages, as Opengl syntax is nearly
the same in Perl, Delphi, Python, Basic...
last revised $Date: 2002/04/23 15:57:58 $ by $Author: pcheyrou $