SetGfxDriver problems on program close

BlitzPlus Forums/BlitzPlus Programming/SetGfxDriver problems on program close

Sauer(Posted 2010) [#1]
Whenever I use the OpenGL driver in B+, my program crashes on close. I tried the suggestion of adding "Setbuffer Desktopbuffer()" at the end of the program but to no avail. Even something like this ends in the "Windows encountered a problem..." message:

SetGfxDriver 2
Graphics 800,600,32,2

SetBuffer BackBuffer()
While Not KeyHit(1)
	Cls
	Color 255,255,0
	Oval 0,0,100,100,1
	Flip
Wend
End


The native driver is way to slow for my game, and DirectDraw runs fast enough, but it's being phased out, correct?

I'm have a nVidia GeForce 8400M GS.

Thanks in advance.


GaryV(Posted 2010) [#2]
This happens for me whenever I use OpenGL and use a graphics window instead of a GUI window. This was reported many years, ago as a bug, but never seemed to get addressed.


Sauer(Posted 2010) [#3]
Lets see if I can get it working in a GUI window tonight... until then, can someone fill me in on the current state and near future for Direct Draw?

EDIT: Wikipedia claims DirectDraw is still part of older versions of DirectX, but has since been replaced by Direct2D. I've read on various threads that it runs under emulation in Windows 7, so what does this entail for compatibility issues?


Sauer(Posted 2010) [#4]
Yeah GUI window may work but definitely not acceptable for my game. This is a real downer.


GaryV(Posted 2010) [#5]
You are using OpenGL, not DirectDraw. FWIW, the bug also exists in XP.

Under emulation on Vista and 7, DD does not use D2D (which only works on 7 and Vista SP2), the emulation translates DD at runtime to use textured quads in D3D.

D2D was designed to replace DD, and is what should be used in the future, but it is not used for DD emulation.

This answer your question?


GaryV(Posted 2010) [#6]
Sauer: You might want to search for a DX9 2D engine that Dabhand made for Blitz Plus. It works very well, and it is free and should be very easy to integrate into your existing project.


Sauer(Posted 2010) [#7]
I was asking about DirectDraw because I basically have three options; the default native driver, OGL, or Direct Draw. DirectDraw is fast enough for my needs, but I was worried about compatibility issues, so I really wanted to go OGL.

Is it safe to use the DirectDraw driver?

As for the DX9 engine, last time I checked it was not in DLL form yet and I couldn't figure out how to compile a DLL properly at the time.

EDIT: It appears Dabz's stuff is down at the moment... I can't connect to directxion.com. Was there a DLL made?


GaryV(Posted 2010) [#8]
Is it safe to use the DirectDraw driver?
My experience only, but DD seems to work better under emulation than older versions of D3D. DD emulation is actually fairly simple. Personally, I would not have a problem using Direct Draw on Vista/7, but would never use older versions of D3D under Vista/7.

As for the DX9 engine, last time I checked it was not in DLL form yet
Actually, Dabz knocked out a DLL for me a long time ago (seems like a year or more back) and posted it. I would imagine it would be at the monkey forums if it is still available. If not, you might want to post over there and ask Dabz. I use his DX9 DLL with BMax daily. It works very well.


Sauer(Posted 2010) [#9]
Alright, I'll just use the DirectDraw driver then, we'll see how it goes when I test it on newer systems. Until then, onward with game dev.

Thanks for your advice GaryV!


GaryV(Posted 2010) [#10]
It would be nice if BRL would fix the bug though ;)


Dabhand(Posted 2010) [#11]

As for the DX9 engine, last time I checked it was not in DLL form yet



If you still need it, heres the source:-

http://www.blitzmonkeys.com/index.php?topic=10.0

Heres the DLL (With DECLS file):-

http://www.blitzmonkeys.com/adminfiles/dabz/DX9_Binary.zip

Dabz


GaryV(Posted 2010) [#12]
Dabz, what is the license on the source? Public Domain?


Sauer(Posted 2010) [#13]
Thanks a million Dabz, I'll get this implemented ASAP.


Dabhand(Posted 2010) [#14]

Dabz, what is the license on the source? Public Domain?



Do anything you like with it Gary, a little credit would be nice for anything released with it, but generally, its open for abuse! ;)


Thanks a million Dabz, I'll get this implemented ASAP



No probs! :)

Dabz


GaryV(Posted 2010) [#15]
Thank you Dabhand. I have been happily using the DLL, but haven't been able to use the source due to we can't use any source unless it is open source.

ps. Don't give up!


Dabhand(Posted 2010) [#16]

ps. Don't give up!



lol, I'm actually eyeing up openGL, sort of cross platform solution that I can chuck into C++, a lot of openGL engines are either way too much for what I need, or not enough.

We'll see how it goes! :)

Dabz


Sauer(Posted 2010) [#17]
Hey Dabz,

I tried your userlib but I keep getting the "User lib not found" runtime error. All of my other userlibs work fine except for this one, any ideas?

Thanks,


Dabhand(Posted 2010) [#18]
Ah, forgots about this yesterday, lol, will investigate! :D

Dabz


Sauer(Posted 2010) [#19]
Take your time, no rush.


Dabhand(Posted 2010) [#20]
Sauer, can you please check your PM's over at BlitzMonkeys please!

thanks

Dabz


GaryV(Posted 2010) [#21]
I am glad to see Dabhand is still giving support/fixes for this.


Dabhand(Posted 2010) [#22]

I am glad to see Dabhand is still giving support/fixes for this.



'fraid not Gary mate, due to certain circumstance, I have no way of testing this with BlitzPlus!

Just wish he asked about 3 weeks ago.

Dabz


GaryV(Posted 2010) [#23]
fraid not Gary mate, due to certain circumstance, I have no way of testing this with BlitzPlus!


I haven't encountered the problem that Sauer describes with the DX9 engine, so I can't be of much help. As to the OpenGL issue, it would be nice if it was fixed as otherwise B+ is a really solid product. It really doesn't affect me though, as I use the GUI side of B+ when using OpenGL.


Dabhand(Posted 2010) [#24]

I haven't encountered the problem that Sauer describes with the DX9 engine, so I can't be of much help.



Could you email a version of that lib to Sauer, yours works, so in respect, if it doesnt on his, then its obviously something else! :)

Cheers Gary

Dabz


GaryV(Posted 2010) [#25]
I am using what was downloaded via the links you posted above. I can download them and email them to him if he wants? It sounds like he may not be using user libs properly (putting the lib and DLL in the right places)?


Sauer(Posted 2010) [#26]
They're in the userlib folder in the B+ directly. My other userlibs work fine, but not this one.


GaryV(Posted 2010) [#27]
Any chance you are on a 64-bit OS?


Sauer(Posted 2010) [#28]
Nope, 32 bit Vista.


GaryV(Posted 2010) [#29]
Since you are on Vista, have you actually downloaded and installed DirectX 9?


GaryV(Posted 2010) [#30]
Also what directory have you installed B+ to?


Sauer(Posted 2010) [#31]
Hmm, I've never thought to see if DX is on my computer. I thought I had because of some classes I took but come to think about it, that was on another box.

Would this mean I would have to include a bunch of DX dll's along with the .exe?

And B+ is in C:/Program Files/BlitzPlus

EDIT: I have DX11 on my machine.

Thanks for the help so far,

Last edited 2010


GaryV(Posted 2010) [#32]
Due to the file virtualization used in Vista/7, it really isn't a good idea to install B+ under program files as you can run into some virtual store conflicts.


GaryV(Posted 2010) [#33]
I am only using the DLL with BMax and I haven't had an issue, but I do have the same DX9 SDK installed on my work systems (and deployment systems) that Dabhand used.

I dug out B+ and I have tried it on XP and 7 here at the house (that do not have the versions of the DX SDK that Dab compiled against) and I am getting the same error as you. Hmmm...

Last edited 2010


GaryV(Posted 2010) [#34]
Ok, on the XP system, the problem is I only have DX9 March 2008 installed. I am downloading the march 2009 version of DX9 and I will install it and try running the B+ example again...

As a note, on Vista and 7, you can install DX9 side by side with what comes on the OS and you often need to to get older programs to run because not everything will work properly under emulation....


GaryV(Posted 2010) [#35]
After updating DX on my XP system, I am still getting the same error. Grrr...


Dabhand(Posted 2010) [#36]
Mmmm sounds like its got to be a bitch, it uses the March 2009 DirectX SDK, so that should of helped if you downloaded and installed the redistributable...

Another possibility is you may need this: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en

But not overly sure as no one has posted about side-by-side errors, but, it was built using VC++ 2008 Express, so worth a punt.

Lastly, and probably the biggy, the only other option really is to recompile the whole source to a new DLL using all the newest bits and bobs there is, it could pick up something there.

It of a bugger mind, wonder whats changed, because obviously, the DLL hasnt!?!

Dabz


GaryV(Posted 2010) [#37]
That was it Dabhand. It works perfectly on XP and 7 here with Blitz Plus once the VC++ 2008 runtimes are installed. I am actually pissed at myself for overlooking that, I definitely should have picked up on that. Doh!


GaryV(Posted 2010) [#38]
As an FYI, I installed the VC++ 2008 runtimes on my 7 machine and I still get the error, but I have not installed DX9 on my Windows 7 machine.

Once I also installed DX9 on Windows 7 the error is gone.

So Sauer: You will need to have the DX9 (March 2009 or newer) runtimes installed on your system and the VC++ 2008 runtimes installed on your system. Your EUs will also need to have these installed to run your games properly. Many people (especially gamers) will already have these installed.


Sauer(Posted 2010) [#39]
Thank you very much for a solution, it is very appreciated.


GaryV(Posted 2010) [#40]
Glad to help.


ozzi789(Posted 2012) [#41]
To fix the crash when using OGL do following steps:

1. Add this to your userlib folder
.lib "kernel32.dll"
api_ExitProcess (uExitCode%) : "ExitProcess"

2. Instead of end use
api_ExitProcess(0)


Hope if anybody stumbels about the same problem this will be helpful.
(tested with windows 7 x64 prof and b+ 1.47)


GaryV(Posted 2012) [#42]
It would still be nice if Mark would actually fix this long-standing bug that has apparently always been here and has apparently been reported many times.