Question on the Direct3D for 2D tiles
I am experiencing a slight problem with the demo files that go along with the article. I can run them once and they run without a single problem but when I exit and restart it, it halts with an error.
I would really appreciate it if someone could provide me with a solution to this problem.
Are you running it in window mode or FullScreen ? I had that problem when i ran fullscreen but It went away by closing out the Directx objects before unloading the program on exit.
I am using vb an im not sure how you do this in C probably very simular. Try emptying the DirectX objects before closing the app.
I am using vb an im not sure how you do this in C probably very simular. Try emptying the DirectX objects before closing the app.
I''m experiencing exactly the same problem. I haven''t looked through the code to see if I could determine the source of it (I would guess it has something to do with the release()-ing of the directdraw stuff). I originally thought it was a problem with my system, its nice to see others are having the problem too.
I''m sure it has some bearing on a particular configuration, as the computer at work does not experience the problem, while the one at home does. Its one of those generic GPF in DDHelp.dll errors, can''t easily debug it.
For posterity, my setup:
Celeron 300a (believe it or not, NOT overclocked)
128 Meg ram
GeForce 256 DDR 32meg video. (Asus 6800)
Windows 98.
DirectX 7a.
Asus video drivers 3.62.
This setup runs other ddraw apps just fine, until I run the article''s code, that is.
*oof*
I''m sure it has some bearing on a particular configuration, as the computer at work does not experience the problem, while the one at home does. Its one of those generic GPF in DDHelp.dll errors, can''t easily debug it.
For posterity, my setup:
Celeron 300a (believe it or not, NOT overclocked)
128 Meg ram
GeForce 256 DDR 32meg video. (Asus 6800)
Windows 98.
DirectX 7a.
Asus video drivers 3.62.
This setup runs other ddraw apps just fine, until I run the article''s code, that is.
*oof*
*oof*
I''ve been messing around with the demos and now discovered that this problem only happens in Demo 2 and up. Demo 1 runs fine no matter how many times I run it. Maybe it has something to do with the textures?
- Ace
- Ace
I didn''t have this problem on my system, but I have a guess based on what I''ve read here.
Each call to SetTexture increments the reference count of the texture surface being assigned. So add the following line right after DrawPrimitive:
D3DDevice->SetTexture(0,NULL);
This will decrease the reference count of the texture surface you used last so that when Release is called in the shutdown code, it will do what you expect without any memory leaks.
Each call to SetTexture increments the reference count of the texture surface being assigned. So add the following line right after DrawPrimitive:
D3DDevice->SetTexture(0,NULL);
This will decrease the reference count of the texture surface you used last so that when Release is called in the shutdown code, it will do what you expect without any memory leaks.
--- Official D Blog | Learning D | The One With D | D Bits
I did what you suggested and placed that code into the spot, yet it still does the same thing. Man, this is really starting to bug me. I want to get this working so I can start messing around with it.
I, too, have been having trouble with the demo files. I''m running Win2K, and when I try to use the demo .exe''s, they will run fine, but when I hit ESC to quit, my comp crashes (its the only things so far that has crashed 2000 for me...) I also noticed that I can Alt-Tab out of the demos and kill them without crashing my computer... Any ideas? Anyone else using Win2K that is or is not having this same problem? I really liked the idea and want to mess around with it a bit (and hopefully use it in my next game )
First off, let me appologise for letting that bug reach the released version of my code. For some reason, the machine I use at home doesn't really seem to suffer from it - but when I saw that people were having troubles, I tested on a few machines at work.
Anyway, I think I've cracked it. I actually added a few extra levels of safety to the code, summarized here:
1. Textures were having both their surfaces and texture handles released. Since QueryInterface upgrades the pointer from one to the other, this is bad.
2. It was possible that after posting the quit message, GameMain would execute once even though shutdown had started. I've added a bool, Quitting, to the program to test for this. Again, this is a silly error.... and one I wish I'd thought of earlier!
3. For some reason, adding a sleep(100) after some of the Release() calls seemed to help so I left it in there.
4. I've added a text-file based logging system; so if its still messing up, hopefully I'll get a better idea of why!
I've applied this to demo4. You can download the new version at http://bracket.eyep.net/newdemo4.zip. This is a relatively low-bandwidth server, so please don't pound it.... I'd appreciate a few people to let me know if this has helped, since I really can't keep trying to crash machines at work!
If you still have problems, please email me the log.txt the program creates. I'd love to sort this one out!
Edited by - Bracket on 3/4/00 1:11:57 AM
Anyway, I think I've cracked it. I actually added a few extra levels of safety to the code, summarized here:
1. Textures were having both their surfaces and texture handles released. Since QueryInterface upgrades the pointer from one to the other, this is bad.
2. It was possible that after posting the quit message, GameMain would execute once even though shutdown had started. I've added a bool, Quitting, to the program to test for this. Again, this is a silly error.... and one I wish I'd thought of earlier!
3. For some reason, adding a sleep(100) after some of the Release() calls seemed to help so I left it in there.
4. I've added a text-file based logging system; so if its still messing up, hopefully I'll get a better idea of why!
I've applied this to demo4. You can download the new version at http://bracket.eyep.net/newdemo4.zip. This is a relatively low-bandwidth server, so please don't pound it.... I'd appreciate a few people to let me know if this has helped, since I really can't keep trying to crash machines at work!
If you still have problems, please email me the log.txt the program creates. I'd love to sort this one out!
Edited by - Bracket on 3/4/00 1:11:57 AM
March 04, 2000 11:52 AM
Just wanted to add that I encountered the same problems
with the original version but with the ported version
using DX7.0 they didn''t occured any longer. But maybe I changed other things too ;-)
Ampaze
with the original version but with the ported version
using DX7.0 they didn''t occured any longer. But maybe I changed other things too ;-)
Ampaze
Hmmm, I am still getting the same results.
Let me try to explain the problem a little better. The first time after a reboot that I run the demos, I get perfect results. It doesn''t crash and runs fine even as it is shutting down. When I try to run it a second time it freezes my computer. After it freezes my computer and I boot up again, I open up the log file and it is blank.
I assume this is a problem due to the releasing of DirectX because it only occurs the second time I run the program. Also note that if I run the demos one time and try to run another Direct3d program, they freeze my computer as well.
- Ace
Let me try to explain the problem a little better. The first time after a reboot that I run the demos, I get perfect results. It doesn''t crash and runs fine even as it is shutting down. When I try to run it a second time it freezes my computer. After it freezes my computer and I boot up again, I open up the log file and it is blank.
I assume this is a problem due to the releasing of DirectX because it only occurs the second time I run the program. Also note that if I run the demos one time and try to run another Direct3d program, they freeze my computer as well.
- Ace
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement