[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [E-devel] Putting GL-textures into Etk, Evas, bla bla... How to choke a horse with words.
Thanks Simon and Jose. I'll get the E source a.s.a.p. and try it out.
Simon TRENY skrev:
The main problem we have here is that what you'd like to do is
definitely engine-specific whereas Evas tends to abstract totally the
engine layer. Anyway, with some Evas engines it should be quite easy to
use OpenGL to render 3D stuff. Here is how to do it with the
GL-X11 engine of Evas (which is obviously the most appropriate engine
to do that since it already provides the GL context).
So, with the GL-X11 engine of Evas, all you have to do basically is to
call all your OpenGL functions before glXSwapBuffers() gets called.
glXSwapBuffers() is called by the output_flush() method of the GL-X11
engine, which is called by evas_render_updates_internal(). So the
problem is that we need to be somehow notified before
evas_render_updates_internal() calls the output_flush() method, and,
for now, there is no way to do that. I have written a small patch for
Evas to add a callback called each time before output_flush() is
called. The function to set this callback is evas_flush_callback_set().
The Evas patch is joined with this email (this patch should not be
applied to the CVS repository of Evas, it's a quick'n'dirty hack!!).
Now, all you have to do is to make the calls to the OpenGL functions in
the "flush-callback". I have attached a a small code that shows how to
do it. It's totally dirty and hacky but it works quite well :) There is
just a small problem with the Zbuffer of with the backbface culling I
guess (the cube looks weird...), but it shouldn't be hard to fix.
To compile this code, you have to apply the patch to Evas, and to
compile it with:
gcc -o evas_gl_proto evas_gl_proto.c `ecore-config --cflags --libs` -lGL -lGLU -Wall