Advice on doing graphics in software

Hi all,

I want to do a mathematics visualization project, and I want to produce a software-rendered (n-D) animation.

The animation should consist of drawing points (tiny circles) tiny numbers, and semitransparent quadrilaterals (representing planes in n-D). I want to achieve the effect of having semitransparent "sheets" stack on top of one another. I know how to compute all the coordinates of the circles and the vertices of the quadrilaterals (everything in C++). I need help on getting a "canvas" (or any other environment) that can automatically draw semitransparent sheets (making the parts of the "sheets" covered by other semitransparent "sheets" slightly darker).

What should I do in order to produce the semitransparent quadrilaterals? I need some kind of a "canvas environment". I will need to draw around 10-1000 sheets and around 1000-100 000 points (depending on what my single-core modest netbook can handle) in at least 10 frames per second. I need to spend no more than 1 day on setting up the canvas environment and testing one semitransparent quadrilateral.

I am using Ubuntu.


Thanks for the advice,
tition
Hi,

This can be done using openGL. For a framework use freeglut or SDL
(freeglut will give you a faster start, SDL allows more control and has other stuff like sound)

Here are the openGL settings (it took me a while to work this out for a similar project I am doing (only 4D))

1. Make the background white
glClearColor(1.0f,1.0f,1.0f,1.0f);
glClear(GL_COLOR_BUFFER_BIT);

2. set blending mode
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);

an oddity with this blending mode is that colours are reversed, e.g. to draw in red instead of rgb(1,0,0) you need to use rgb(0,1,1)

to draw a transparent red square
glColor4f(0.0f,1.0f,1.0f,0.5f); // the last number is the transparency (alpha)
glBegin(GL_QUADS);
glVertex2f(1.0f,1.0f);
glVertex2f(-1.0f,1.0f);
glVertex2f(-1.0f,-1.0f);
glVertex2f(1.0f,-1.0f);
glEnd(GL_QUADS);

a book like openGL superbible will give a fast introduction to glut and openGL

Using this blend mode the sheets can be drawn in any order (no need for sorting) and the blending will come out the same.
This means you can do large numbers of transparent shapes, even on a netbook

Good luck

Mike
Topic archived. No new replies allowed.