How to create gsg?

When we call open_window(), it seems that gsg=null.

Is that true for all cases? :blush:

How to get the default gsg (null?) that is used by the default engine? :unamused:

How to create our own gsg? :confused:

Hi, Have a look at

do_add_gsg() is a private function that you shouldn’t be calling. We used to have an interface to allow you to create a gsg explicitly, but we have more recently folded that into the window code; a window creates a GSG when it is opened, if it doesn’t have one already.

So the way to create a GSG, if you really need a new one, is to pass NULL into the window creation code and let the window create it for you. Note that you need to call graphicsEngine.open_windows(), or let a frame go by, to give the window a chance to open.

Then you can get the GSG with window->get_gsg(), as jean-claude points out.


It seems that the real meaning of “gsg=null” is “let game engine do it for you”. :smiley:

Then, how to map Python code of “myWindow.setupCopyTexture()
myTexture=myWindow.getTexture()”, especially for :blush: cube_map[0]…cube_map[5]? :blush:

I don’t know what you mean by setupCopyTexture–maybe you’re referring to setupRenderTexture()? This is a direct call to the C++ method GraphicsOutput::setup_render_texture(). And window.getTexture() in C++ looks like window->get_texture().

In general, most function names in Python map one-to-one to the same functions in C++, by making it lowercase and inserting underscores between words.

You seem to be asking something more specific, but I don’t understand what you’re asking.


Ah, I see. You must have been looking at the page in the manual called “The GraphicsOutput class”.

Eww, that page is filled with outdated and inaccurate information. I’d fix it, but it’s really such a mess, I don’t know where to begin. All of the pages right around it are similarly confused.

So my question for you is: what is it that you’re trying to do, exactly? Are you just trying to create an offscreen buffer to render a cube map? buffer = window->make_cube_map() will do this for you automatically; this method returns a new GraphicsOutput that will render the six faces of the cube map. You can use buffer->get_texture() to get a pointer to the resulting cube map. See the generated API documentation for GraphicsOutput::make_cube_map() for more information.


I am coding “Dynamic Cube Maps” in C++ according to the outdated manual “The GraphicsOutput class”.

So i confused with "setupCopyTexture(), detachTexture() " :laughing:

By the way, if we want to change the font used to render window’s title, how to do? :cry:

I’m not sure which title you’re referring to. Normally “window title” refers to the text within the titlebar at the top of the window, and that font is chosen by the operating system and has nothing to do with Panda. But if you mean some title within the window itself, as generated by a TextNode, then you only have to load a font of your choosing, via FontPool::load_font(), and set it with TextNode::set_font().


Yes, it is the title of GraphicsWindow, we can use WindowProperties::set_title(…) to set it.

However, supposing we are in Fedora 12 and want to use a differnt font to show this title, how to do?

You can configure the fonts of all window titles via the Desktop Appearance dialog. The font is selected by the user at the keyboard, not by the application. Each user is free to select his or her favorite font for the window title; you can’t override that choice in Panda.

Why, have you seen an application that does this?


I want to show Chinese Character in the window title.

It can be achieved easily in Windows, but not in fedora 12.

I have successed using TextNode to show Chinese Character, and tried to feed in set_title() with get_text(). However, it still failed.

I have tried to change the font through Fedora’s Management Tools. It has effect on the apparent of the window, but can not show Chinese Character yet!

What is the matter? :blush:

Sounds like an issue with Fedora, not Panda. Panda has nothing to do with displaying the title bar.


:imp: pending now…

I tried to implement dynamic_cube_map in C++.

Now I can make the un-textured teapot moving in the scene.

However, when I add the following lines into the code, the window crashed silently, can you help me?

        //load teapot and scene
        //create camera_rig
        NodePath rig = NodePath("rig");

        GraphicsOutput * buffer =


        PT(TextureStage) defaultOne =   

The Output is:

[color=red]Known pipe types:
(all display modules loaded.)
Loading teapot.egg
Loading streetscene/street-scene.egg

What is wrong?

I don’t see much wrong with the code you pasted, though you should replace this line:

GraphicsOutput * buffer = window->get_graphics_output()->make_cube_map("env",64,rig); 

with this:

PT(GraphicsOutput) buffer = window->get_graphics_output()->make_cube_map("env",64,rig); 

because GraphicsOutput inherits from ReferenceCount, and thus it is always important to use a PT(GraphicsObject) instead of a simple GraphicsObject pointer, in order to hold the reference count and prevent it from being destructed implicitly.

I don’t know whether this is what’s causing your crash, but it is a likely guess. If making this change doesn’t fix it, though, then it must be somewhere else. Can you get a C++ stack trace at the time of the crash?


When I step into PT(GraphicsOutput) buffer = window->get_graphics_output()->make_cube_map("env",64,rig); step by step, It remains OK.

However, when I continue to run the program, an error occurs. The information in the Disassambly window are:

The gdb trace info are: