framework.open_window() fails to create window

Having a problem running a simple C++ program. I’m using MSVC 2008. Read the manual and set up my environment appropriately. Created a console project and entered the code listed below.

The “framework.open_window()” call returns NULL.

My OS is Windows 7. I really wish there was a debug version of the libs so I could step through and try to figure out what’s going on.

Does anyone have any ideas?

Thanks, and code is here:

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

PandaFramework framework;

int main(int argc, char* argv[])
{
framework.open_framework(argc, argv);
framework.set_window_title(“Hello World”);
WindowFramework* window = framework.open_window();
if (window != (WindowFramework*)NULL)
{
window->enable_keyboard();
window->setup_trackball();
framework.main_loop();
}
else
{
printf(“Can’t open window\n”);
}

return 0;

}

Is there an error message written to the console?

Note that, incidentally, you can step through the program even in release mode. It works, it’s just sometimes a little confusing.

David

No error messages…app just pukes. So i set a BP at the open_window() call and could see that it was returning NULL.

Can’t step through or even inspect var values - probably because there are no pdb’s or _d libs.

Strange. I’m installing Netbeans now to see what happens there…

Thanks

Well, one thing about stepping through in release mode, is that you can’t really trust the values you see in the watch window. Observing that the function appears to return NULL in the breakpoint doesn’t necessarily mean that it’s true. But if your program prints “Can’t open window” then I’ll believe it.

But I’m pretty sure all the cases that would cause open_window() to return NULL would also cause it to write something to the log, so I’m surprised. Does pview work successfully?

David

Logs? Didn’t know there were any. I’ve got lots of experience with Dev Studio but very new to Panda3D - and would much rather use C++ over Python. A log file might be a huge help. I’ll check into it.

Yes pview works, but I’m not sure how that helps me?

The “log” is by default written to the console, though you can change this by putting a line like:

notify-output /c/my/folder/myfile.txt

in your Config.prc file.

Since pview works, it means the problem isn’t something that fundamentally prevents Panda from running; it must be something specific to the way you’re building your app, somehow. When you say it “works”, do you see the output written to the console, things like “:display: loading display module”, and whatnot? And you do see this output in your own application?

David

OK, we’re zeroing in on the problem! Thanks for your help.

I forgot to check the console output (when you run from the IDE the window comes up and goes away, so I totally forgot to check the output), here’s what I get:

:display(warning): Unable to load: The specified procedure could not be found
Known pipe types:
(all display modules loaded.)
No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
Can’t open window

I didn’t know about the config.prc file…So I found the file and modified the following (I added the aux-display part):

load-display pandagl
#load-display pandadx9
#load-display pandadx8
#load-display tinydisplay
aux-display tinydisplay

And I now get a window…but the question now is: why doesn’t pandagl work?? I’ve run tons of opengl-based applications.

Thanks again

pandagl not working by default on a system is actually very common since the default OpenGL drivers that come with Windows aren’t usable. Even the drivers from the manufacturer are broken sometimes. That’s why you don’t barely see any commercial OpenGL game nowadays. Did you get updated drivers from the GPU manufacturer website?

But you say that there are OpenGL apps that work for you so that is surprising, can you tell us which apps? (personal interest, if your problem is bad drivers I would like to know how they manage to work at all)

OK, messing around with the config.prc, I found that using directx8 works. Thanks for all the help.

Still not sure why opengl doesn’t work though.

Gogg: I “think” I have had opengl apps work on my pc, but now that I think about it, not quite sure they were using opengl and not DX. I’ll try to track that down and let you know.

Thanks for the help…

RB

You say DX8, I assume you tried DX9 but didn’t work. You should try to at least run panda in DX9, since DX8 is very old and doesn’t support advanced features.

Just get the DirectX End-User Runtime Web Installer. For getting OpenGL to work just update your drivers. OpenGL is the best supported renderer in Panda, by the way, it supports all the features, so it might be better to use that for learning, then struggle to make your game work with DX when it’s done, if you are interested in avoiding headaches to the users.

I don’t understand why DX8 works and DX9 doesn’t, though.

I don’t know…it’s very strange. I updated my OpenGL drivers weeks ago (driver OpenGL version is 6.xxx) - that should be good. I installed DX9, but it still doesn’t work. DX8 is the only one that works.

I took a quick look at the panda sources for a clue, but don’t have the time right now to track that down.

Could this have something to do with running Windows 7 and changes in registry locations?? I have a Vista machine - I should try that and see what happens.

As for OpenGL - I much prefer this over DX, so I would really like to get that working.

Changes in registry locations shouldn’t cause that, though maybe you have found a related bug. The SDK takes care of that. You could try 1.6.2 just to see if it’s a bug of 1.7.0, which is fairly recent so it could happen.

I use Windows 7 too btw, and don’t have that problem.

Changes in registry locations shouldn’t cause that, though maybe you have found a related bug. The SDK takes care of that. You could try 1.6.2 just to see if it’s a bug of 1.7.0, which is fairly recent so it could happen.

I use Windows 7 too btw, and don’t have that problem.

Did you enable multisample per chance? If so disable it to test, it’s one of the things that changes with respect to windows creation in DX9.

OK, had to take a break - life’s priorities and all…so I’m back.

I tried 1.6.2 and it failed in a different way (couldn’t find an entry point in cg.dll - can’t remember what the entry point was but a google search didn’t turn anything useful up).

As far as multisampling: my video card is configured to leave that up to the applications, and I never knowingly set up Panda to use it, so I have to assume it is not enabled.

I can successfully build the panda sources, but it’s not clear to me how to build debug versions…perhaps stepping through the code will be of some help?

OK, I rethought the whole 1.6.2 thing (since it’s really the last “stable” release) and reinstalled it. It actually does provide more information.

1.6.2 also fails for opengl and directx9 (but not directx8), but I get a popup when it fails that says:

“The procedure entry point cgiGetParameterBaseType could not be located in the dynamic link library cg.dll”

I suspect it is this same problem that could be causing failures in 1.7.0 as well, but without the popup.

Any ideas as to how to solve this? Obviously it’s finding the dll…

Thanks again

WooHoo! The problem was that I had installed nvidia’s cg toolkit a few weeks ago for some shader work I was doing and apparently those dlls were being found first. I uninstalled the toolkit and it works (for 1.6.2 at least).

I’d guess that this was also the problem for 1.7.0 - I’ll try to test that later and see.

Thanks for all your help

Ah, that does make sense! I don’t think we intentionally disabled that informative popup for 1.7.0, but it might have gotten turned off accidentally. I’ll investigate.

David