Hello soya users :)

There have been many people on IRC who have asked how to render soya in 
a QT or GTK widget so I decided to try it and to make some tutorials 
about it. I've managed to use soya into a PyQT 4 opengl widget, you can 
get a screenshot here
http://aliasrobotique.org/~souvarine/soyaqt1.png
This is the basic-2 tutorial with the rotating sword but into QT. the 
button start or stop the rotation of the sword, it works very well.

Problem is that I couldn't make it without hacking soya sources a bit. I 
think we should modify soya a bit to make this easier. Here you can find 
my tutorial and the two soya source files I had to modify to make it 
work (init.pyx and mainloop.pyx).
http://aliasrobotique.org/~souvarine/soya_qt_test.tar.gz

In init.pyx I added two functions, set_video_size() that set the size of 
the rendering surface in opengl and set_stencil() that set the depth of 
the stencil buffer. In mainloop.pyx I've moved the "for i in 
BEFORE_RENDER: i()" out the render() method. I couldn't figure out why 
this had to be in this method, so I put it in main_loop() and update() 
instead.

Those modifications seems pretty dirty to me, I would like to find a way 
to make all this cleaner so I'm asking for your opinion :)


Something else that bother me, after adapting the basic-2 tutorial to QT 
I've tried to do the same with basic-5 and basic-6 to see how to deal 
with keyboard and mouse events. Since no SDL surface is created, SDL 
don't catch any event. I've tried to make a QT to SDL event conversion, 
using SDL_Push_event() to send the event I got from QT into SDL queue so 
that they can be retrieved with soya.process_event(). It didn't work. I 
figured out that when SDL_VIDEO is not inited the SDL queue is disabled.

I wonder what should be done here. Let the user know that if he choose 
to use soya in some GUI system soya.process_event() wont work and he 
will have to deal with event by himself ? Or provide some other way to 
send fake SDL event (like a soya.push_event() function) ?

Once again I'm asking for your opinion.

Souvarine.


_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user

Reply via email to