A canvas in a pyglet window.

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
andrecaldas
Halfling
Posts: 54
Joined: Mon May 06, 2024 1:06 am
x 3

A canvas in a pyglet window.

Post by andrecaldas »

Fellow Ogres,

I am new to Ogre. My plan is to write a CAD software. Not a game. The idea is to have the UI in python and have some "canvases" in the UI to be used as Ogre viewports.

There is a python project called Pyglet. I expect to be able to create a window in Pyglet and a widget to be used as a canvas. I'd like this canvas to be an Ogre viewport.

If I don't know much about Ogre, I know even less about Pyglet. :mrgreen:

What I am saying makes sense? Is it a good idea? A bad idea? What do you think I need to do to get the job done? What do I need from Pyglet to be able to use its canvas with Ogre?

https://pyglet.readthedocs.io/en/latest ... anvas.html

rpgplayerrobin
Gnoll
Posts: 685
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: A canvas in a pyglet window.

Post by rpgplayerrobin »

I would start by just using Ogre.

The first step you should do is to learn Ogre, just make a small scene where you can actually render something, and you can easily learn that by building Ogre from source and testing/changing any Ogre sample.

Then, learn about multiple viewports.
Simply add a new viewport with a new camera and then adjust its actual position on the window.
That way you can have, for example, 4 different viewports rendering the same scene but in different views (because of different cameras, you can also make it so a camera could render in orthographic mode instead of perspective mode, which is important for things such as CAD).

You could also instead use render targets to render to a texture instead of using multiple viewports rendered directly into the window.
Then you can just show the render targets texture on the screen by adding it as a simple UI element (but probably with no filtering and make it pixel perfect by scaling it by its texture size on the screen).

If you get all this working, I don't really see any point in having anything to do with pyglet?
If you really want python, there are bindings for that, and you can also use stuff such as LUA if you really don't want to code.