PyOge and PGU (or a PyGame Surface)


16-06-2006 22:33:02

Hi there.

I am new to OGRE and PyOGRE (and mostly new to PyGame too).

I want to use Phil's PyGame Utilities (PGU) for it's gui system, but I need to find a way to make it work with PyOGRE.

Has anyone has any luck doing this?

(I am trying to avoid CEGUI if I can.)

I was thinking I could create a OGRE ExternalTexture plug-in and take the rendered gui and output it to that, but I am just guessing.

Alternatively, has anyone had success putting a PyGame Surface over the PyOGRE window?

Anyway, any pointers would be greatly appreciated.

Thanks in advance,


17-06-2006 18:43:14

Sample code integrating with PyGame is in the pyogre wiki:

Because it's using the pygame windowing system, I would guess that the GUI written on top of that would work too.


17-06-2006 21:24:25


Thanks for replying. :-)

I have already seen that wiki page and I am using it as the base for my learning.

It successfully puts ogre in a pygame window, but does not indicate how to draw pygame surfaces on top of the ogre window, without getting flicker from ogre redrawing every frame, or specifically how to draw PGU widgets over the ogre window without flicker.

If anyone has any experience/konwledge with this, I would greatly like to hear from you.

Thanks again,


19-06-2006 10:28:40

Now I really don't know what I'm talking about here, but if you're getting flickering I imagine you're drawing directly to the screen rather than drawing to some buffer instead.

So either you want to get hold of ogre's buffer and draw to that in between ogre rendering and displaying, or you want to render ogre to your own buffer, draw your gui on that, and then blit the whole thing over to the screen.

I have no idea how to do all that, and it could be completely the wrong approach, but hey, it's and idea you could try.


20-06-2006 00:35:39

Actually, those are great ideas. I also have no idea how to do any of it, but I will try and find it out.

Thanks for the ideas! :-)


16-11-2008 05:50:44

Does anyone have any information regarding this? I am having trouble finding a way to have ogre render to another buffer to be accessed pygame, or even being able to render over the screen at the same time in any way. renderOneFrame() renders directly to the screen and the screen variable from from pygame.display.setmode doesn't ever have the information in it that is written by the renderOneFrame so I can't even let ogre render one frame then draw using pygame in the next frame. This solution would have been acceptable as the application doesn't have to render constantly, only when changes are made which is not that often.

Any ideas would be appreciated

Edit: Thats a little rambling, so to clarify I just want to render 2d onto the screen on top of the ogre rendering, with transparency. I find the overlay API to be excessively complicated and can't really find good examples for using it. CEGUI is clearly intended for GUI not for arbitrary rendering on the screen.


16-11-2008 10:31:01

Well the basic approach for using another gui system would be to draw the gui on one or multiple textures and pass it/those over to ogre, which would integrate them as normal overlays. You don't need a pygame window at all.
You might want to look at this project's source code:
But why use another gui when there are so many ogre guis. There is not only CEGUI and only few people still use CEGUI. :wink:
If you can't decide on which gui to choose you could probably post your requirements here.


16-11-2008 20:38:00

It's not really a GUI at all, its further arbitrary 2D rendering done to the screen on top of the 3d rendering. Even if I chose to use billboards it seems excessively complicated to position them the correct distance from the camera and write with 2d functions to the billboard texture rather than being able to use the pygame or other libraries polygon/blit functions.

Edit: To clarify, I am looking for a way to get the Ogre3d rendering into a pygame Surface or possibly a pygame Surface into an Ogre3d texture.