2d heads-up display

Hello,
in my game i created some heads-up windows using CEGUI
but the problem is that they are sometimes hidden,
sometimes visible.
I allready set depth_test and depth_write to false
but it is not working.

window->get_render_2d().attach_new_node(callback_node); //Add the CallbackNode of CEGUI to 2D render
//window->get_render_2d().set_depth_offset(0); //Testing
//window->get_render_2d().set_bin("fixed",1); //Testing
window->get_render_2d().set_depth_test(false);
window->get_render_2d().set_depth_write(false);

I am now trying to create a extra display region
but there my problem is that i do not konw how to convert the camera into nodepath.

	DisplayRegion* region2d = window->get_graphics_output()->make_display_region();
	region2d->set_sort(20);

	Camera myCamera2d = Camera("myCam2d");
	NodePath myCamera2dNode = ???;
	OrthographicLens* lens = new OrthographicLens();
	lens->set_film_size(2, 2);
	lens->set_near_far(-1000, 1000);
	myCamera2d.set_lens(lens);

	NodePath myRender2d = NodePath("myRender2d");
	myRender2d.attach_new_node(callback_node);
	myRender2d.set_depth_test(false);
	myRender2d.set_depth_write(false);
	
	myCamera2dNode.reparent_to(myRender2d);
	region2d->set_camera(myCamera2dNode);

please help me.

Could your CEGUI disappearing problem be the same as this one: [PyCEGUI / CallbackNode render bug with shader generator) ?

Converting a Node to a NodePath is as simple as calling the NodePath constructor:

PT(Camera) myCamera2d = new Camera("myCam2d")
NodePath myCamera2dNode(myCamera2d);

Note that a Camera object should always be created as a PT(Camera), never as a concrete object, because it inherits (indirectly) from ReferenceCount.

David

ok thanks
i did not try to use a pointer
anyway, it does not help

i have the same problem as in the thread
but they still have no solution

OK, perhaps we have to wait until a solution is found. Sometimes many eyes can help find a solution faster–would you like to help research the problem, following the suggestions given in that other thread?

David

you wrote
i just need to add glActiveTexture(GL_TEXTURE0)
but which include did i need?
or is it in c++ in a class or namespace?

#include <GL/gl.h>

OpenGL is C, so it’s not in a namespace or class.

hmm does not work
my code:

#include <pandaFramework.h>
#include <pandaSystem.h>
#include <GL/gl.h>

#include <CEGUI.h>
#include <CEGUISystem.h>
#include <RendererModules/OpenGL/CEGUIOpenGLRenderer.h>
#include <CEGUIDefaultResourceProvider.h>

#include <callbackData.h>
#include <callbackNode.h>
#include <callbackObject.h>
#include <orthographicLens.h>

#include <mouseWatcher.h>
#include <buttonThrower.h>
#include <event.h>
#include <eventReceiver.h>

class GUIUpdateCallback : public CallbackObject {
public:
	ALLOC_DELETED_CHAIN(GUIUpdateCallback);
	void do_callback(CallbackData *cbdata){
		glActiveTexture(GL_TEXTURE0); //not found
		CEGUI::System *guiSystem = CEGUI::System::getSingletonPtr();
		if (guiSystem){
		  guiSystem->renderGUI();
		}
		if (cbdata){
		  cbdata->upcall();
		}
	}
};

What do you mean “not found”? Do you mean the compiler complains there is no such symbol defined? glActiveTexture() is new as of OpenGL 1.3, so if your system’s OpenGL headers are older than that, it won’t be defined. (Of course, “new” is relative, as OpenGL 1.3 was released in 2001, but there are indeed some systems out there with OpenGL headers older than that. It’s possible that the default Microsoft-provided OpenGL headers are only 1.1, as Microsoft sometimes appears to go out of their way to make OpenGL development difficult.)

There are various ways of working around this, including (a) installing a later version of the OpenGL headers, (b) including glext.h, or © using the OpenGL extension system to call it as an extension function.

But none of these are exactly trivial, and I gather that you are fairly new to OpenGL programming, and C/C++ programming in general. So perhaps the simplest advice will be to pick up the latest version of Panda3D from the cvs source tree, which solves this problem for you.

David