Need Help

Hi All,

I am a student from Nanyang Polytechnic Singapore, I currently want to make a game using Panda3d, I am newbie in Panda3D.
I am using Panda3D 1.7.0, visual studio 2008, window xp
when I tried to run below code(I tried to use TextNode, the compilation was successfull but when I run it, it was crash, please help).
This is my code

#include “pandaFramework.h”
#include “pandaSystem.h”

PandaFramework framework;

int main(int argc, char *argv[])
{
framework.open_framework(argc, argv);
framework.set_window_title(“Gun Shooter”);

WindowFramework *window = framework.open_window();
if (window != (WindowFramework *)NULL) 
{
	nout << "Opened the window successfully!\n"; 
	
	PT(TextNode) text;
            text = new TextNode("node name");
            text->set_text("Start Game");
            NodePath textNodePath =             window->get_aspect_2d().attach_new_node(text);
            textNodePath.set_scale(0.07);

	window->loop_animations(); 
	framework.main_loop();
} 
else 
{
	nout << "Could not load the window!\n";
} 

framework.close_framework();
return(0);

}

This is the crash

#else /* WPRFLAG /
__initenv = envp;
mainret = main(argc, argv, envp);
#endif /
WPRFLAG */

Thanks,
James

A crash at startup usually means you have something wrong in the compilation options. In this case, you have used the wrong compiler. There might or might not be other things wrong as well, I don’t know; but you’ll certainly get a crash if you don’t use MSVS 2009, the same version of the compiler that we used to build Panda3D 1.7.0.

David

Hi David,

Thanks for your prompt reply. I have tried Camera, LoadModel, Task, Texture is working fine using visual studio 2008, but when I tried TextNode it was crashed. Please advise if is it possible if I want still use Visual studio 2008 or do i need to change to Visual studio 2009 so it will be compatible to all the function in Panda3D 1.7.0 ?

Thanks,
James

No, you must switch to 2009. Sorry.

Or, you may use 2008 if you are willing to rebuild Panda from source, and link against that version that you built, instead of the libraries provided here.

David

Er… don’t we use VS 2008 to compile Panda3D 1.7.0?

I use VS 2008 (Express) successfully with Panda 1.7.0.
I haven’t heard of any 2009 version of VS… the latest one is 2010.

Hi Esak/rdb,

Thanks for your prompt reply. Some function is working, but when i tried TextNode, it was compiled successfully but crash when running. I used Panda3D 1.7.0 ready use(I didn’t build the source code). do you mean that you build Panda3D 1.7.0 source code using visual studio 2008 express?

Thanks,
James

I’m pretty sure that 1.7.0 is built with Visual Studio 2008.

I haven’t built the source code.
I use the Panda 1.7.0 ready use, as you do jamz_martin.
I haven’t though tried TextNode.

To clarify…

MSVC8 = Visual Studio C++ 2005
MSVC9 = Visual Studio C++ 2008
MSVC10 = Visual Studio C++ 2010

drwr has just mistyped here, he meant that you must use MSVC9, (not MSVC 2009, which doesn’t exist), and that MSVC8 won’t work (he was talking about 2005).

Recapping: Panda3D was built with Visual Studio C++ 2008 Service Pack 1 and that is what you must use. The service pack is very important. Maybe you just haven’t installed the service pack?

Oh, oops, my apologies. Rather silly of me. :frowning:

David

Hi Goog/David,

Thanks for prompt reply. I have installed Service Pack 1 for My Visual Studio 8, but still give me the same issue.
As mentioned before, my code is so simple, I just want to use PT(TextNode) but it was crashed when I run the program. Please advise how to fix this issue. Thanks

=====================
#include “pandaFramework.h”
#include “pandaSystem.h”

PandaFramework framework;

int main(int argc, char *argv[])
{
framework.open_framework(argc, argv);
framework.set_window_title(“Gun Shooter”);

WindowFramework *window = framework.open_window();
if (window != (WindowFramework *)NULL) 
{
	nout << "Opened the window successfully!\n"; 
	
	PT(TextNode) text;
	text = new TextNode("node name");
	text->set_text("Start Game");
	NodePath textNodePath = window->get_aspect_2d().attach_new_node(text);
	textNodePath.set_scale(0.07);

	window->loop_animations(); 
	framework.main_loop();
} 
else 
{
	nout << "Could not load the window!\n";
} 

framework.close_framework();
return(0);

}

Did you remember to remove NDEBUG from the defines in your project settings?

David

Hi David,

Yes, it is working if I remove NDebug, Thanks for your help:), you are genious:). Anyway Please advise for the reason why because NDebug, it’s not working.

Thanks,
James

It’s because we built the Panda version for distribution here without NDEBUG, so it means you need to build your version without NDEBUG as well.

If you don’t have this symbol defined the same way in the library and the application that uses it, then some of the headers will define mismatching data types, and you will eventually crash.

David

Thanks for your help.
I am newbie in Panda3D and also not able to read/write program in Python. I want to ask to use OnscreenImage in C++, I tried to search in google but couldn’t find it. in Manual, there is an example only in Phyton. Any advise for this newbie question?

Thanks,
James

OnscreenImage exists only in Python. However, it’s a very thin wrapper around CardMaker, which exists in C++. Use CardMaker to create a card of the appropriate size, and then use NodePath::set_texture() to apply your texture to it.

David

Hi David,

Thanks for help. another newbie question, I have a 3dmodel(.mb (maya)), I open in Autodesk Maya 2009, the file actually have the color and the animation, but when i convert to .egg (maya2egg2009 C:\Panda3D\models\cat.mb -o cat.egg, the animation and the color is gone.
I don’t have any idea what’s going on here.kindly your advise

Thanks,
James

As the Panda3D manual describes, you must use the “Phong” type shader in order for its attributes to be correctly converted to egg. Perhaps you used a different kind of shader to define the color?

As for the animation, the default is to convert a model as a static model, which is more efficient if you don’t want animation. If you do want to preserve the animation, you have to supply the “-a both” flag, or run it in two passes, one with “-a model” and one with “-a chan”, to produce two egg files that you load up together. This is also explained in the manual.

David

Hi David,

Thanks for advise. I notice Color is not converted to .egg even the shader is phong, must file? please advise.
I notice the animation is not working also. I used -a chan for the animation. Can i send you the .mb file, only 300kb.

Thanks,
James
[/code]
[/url]