Hi,
I want to display image on the background of the scene (no skycube or skydome; just 800x600 image on the background, always facing camera).
I want to change this image every frame (with data form a webcam but also data from fractal generated in the memory. (so OpenCVexture wan’t go)
What is the most efficient and eassyest way to do that?
Currently I’m putting image in the background like this:
But don’t know how to change texture data. I was considering texture->set_void_ptr or set_raw_data
but it ins’t obvious how to convert my row data RGBRGBRGB… to fit classes.
By default, render2d renders after render, so that gui items are drawn on top of the 3-D scene. You can change this so that render2d is drawn first, but then all of render2d will be behind the 3-D scene. If that’s OK to you, you can do it with this:
window->get_display_region_2d()->set_sort(-10);
Note that render and render2d each have their own DisplayRegion, and that the DisplayRegions are drawn in order according to their sort values. So setting render2d’s sort value to a negative number makes it draw before render (whose sort value is 0).
If you want to use a render2d-like scene graph for your background card, and still have gui elements on top, then you will need to create a third DisplayRegion for this purpose. This is easy to do; examine the code in windowFramework.cxx for examples, or look in this forum, or look in the manual.
Thanks.
Well it seems in Panda 1.6 there is no get_display_region* in class WindowFramework, nor a get_graphics_output so I can create a new display region …