Hi !
I need some advice about 2D rendering with a 3D engine.
I have a 2D application, running with SDL 1.2. It computes 2D vector
graphics with a software 2D engine. The image is computed in a user
memory buffer (a int array of RGBA values) than bilt to the SDL screen.
It works fine, but when the resolution is rather high (1680x1050) or if
the host is limited in CPU power, the performance is not very good when
the 2D scene is animated (3 to 10 fps).
I’d like to use a 3D engine to speed up rendering and blit. I am
thinking about using ShivaVG (based on OpenGL, see the
(http://sourceforge.net/projects/shivavg/)).
I converted the ShivaVG tests to SDL (replacing glut by SDL) and that
works fine, with both Linux/X11 and MS Windows.
The problem is that the 2D scene is not often animated and it seems (I
am not an expert at all) that OpenGL needs to be rendered all the time:
if the 3D scene is computed once and than enter the event loop, if the
SDL window gets covered by another, it is not refreshed. That problems
does not exist with ‘non OpenGL’ SDL window (refresh is made by some low
level magic, no need for the application to do some repaint).
Rendering 3D all the time requires CPU / GPU power, with is bad for a
laptop (for example a netbook) or a MID device (more and more low cost
devices have a 3D engine, OpenGL ES and/or OpenVG - see for example
http://www.malideveloper.com/ ).
Is it possible to do things such as:
- compute an image with the 3D engine when needed than display a
snapshot in a SDL ‘not OpenGL’ screen - take a snapshot of the last image (end of the animation), convert it
to a texture and display it at no CPU / GPU / power cost, with some
automatic low level refresh - freeze the 3D engine in a mode that would redraw itself automatically
when needed (window raise, de-iconification, …) - other idea …
Thanks for your feedback, regards,
Lo?c