Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Very strange display mode change/D3D crash

Author
Message
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 24th Apr 2011 18:04
Hello

This is really strange. If you're using Cloggy's D3D plugin, would you mind copy/pasting these four lines of code, then running the program in fullscreen mode? I get a horrible crash:



Even though the d3d_font command is not executed, it crashes. Weirdly, if you comment out the make object sphere command, it doesn't crash!

I reckon the inclusion of a d3d command causes DBP to link the d3d dll, and that's where the crash is happening.

I'm using Win7, 64 bit btw, but I've run the exe on my XP laptop, and it crashes on there too.

Any thoughts on how I can get round this? I really want to be able to change the screen resolution on the fly.

Thanks as always for your input.

Jambo
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 24th Apr 2011 18:49
1) The command 'end' ends the program, so the program doesn't crash it's ending.

2) You cannot use D3D commands without calling D3D_Init first.

3) Changing the display mode resets all resources(3d objects, images, etc)

Example of changing display mode while in fullscreen



Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 24th Apr 2011 19:00
Thanks for the reply.

1. The program never reaches the end, because it crashes. What should happen is a graceful exit when it reaches the END statement. Instead, there's a proper crash.

2. I know about D3D_Init. The D3D_Font command was included in my program just to force DBP to include the D3D DLL.

3. In the project I'm working on, I'm reloading/recreating resources after a display mode change.

Didn't the program crash on your computer? It does horribly on mine in fullscreen mode (but works on windowed fullscreen)
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 24th Apr 2011 19:26
Your program crashed on my computer. However, my code didn't crash. Did you try my code?

Here's another, slightly more complicated example.



Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 24th Apr 2011 20:20
Yep, your code works fine. Problem is, as soon as a command like this:

d3d_font 1, "times new roman", 10, 0, 0, 0

appears anywhere in the code (even after the end or in a function) it causes the crash:



Your code as above, but with the d3d_font included. This causes the program to crash, even though the d3d_font instruction never gets executed.

Hmm!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Apr 2011 23:09 Edited at: 24th Apr 2011 23:10
Did you use "d3d_init" before you used any of the other d3d commands?

It might be some important 'initialisation' is not being done...

EDIT: Just read your answer to this...
Quote: "2. I know about D3D_Init. The D3D_Font command was included in my program just to force DBP to include the D3D DLL."

Yes but it still needs to be called.

Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 25th Apr 2011 15:34
Thanks baxslash

Just tried it, but it still crashed.

I'd ask for Cloggy's advice but he seems to be away at the moment. Looks like I'll have to find another way to render text quickly. What a shame - I really liked d3d_boxtext.

Jambo
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th Apr 2011 11:13
Quote: "Just tried it, but it still crashed."

Me too and yes it crashed in fullscreen for me too...

That'll give me some problems with a game I'm working on. If I find a solution I'll let you know. In the meantime I would still try emailing cloggy or posting on the d3d thread just in case he checks in at some point.

Could you use fulldesktop instead of fullscreen? It appears the same just runs a bit slower because it's actually still windowed. I just tested it and it worked fine.

You could try SvenB's bitmap font kit?

Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 26th Apr 2011 20:30
Ive had this issue with the GDK version and using Fullscreen Exclusive it has to do with D3D not getting the device after the change in resolution I believe as I solved this using fullscreen without the exclusive mode, and I no longer had problems, try calling D3D Init after the resolution change though


Making dreams possible, one line at a time...
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 27th Apr 2011 00:13
Thanks to all for your replies on this... I'm with you, Baxslash - this issue is going to give me some problems. Wish I'd tried fullscreen exclusive and spotted the problem before I wrote so much code.

I'd love Cloggy to read this and fix it, but like a lot of us here I'm sure he's a busy chap.

Has Cloggy released the source code for d3d? If so, I'd be happy to have a look at it, although my CPP dev environment of choice is Embarcadero rather than Microsoft.

Jambo
Jimmy
20
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 27th Apr 2011 01:01
Quote: "Has Cloggy released the source code for d3d?"


Yessir!

http://www.dbdepot.co.uk/d3dfunc.html


May 10th / Geek Culture / Jerico2day-OBese87 / VOTE
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 27th Apr 2011 01:28
Ooo! Looks rough - Cloggy is a clever chap!

And it's written in vc.

Must say, I dislike going through other people's code, although it does look well commented.

Got to find some hours to look at this...

Jambo
enderleit
16
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 27th Apr 2011 12:32
d3d_init is called automatically at the start of the program, but it can't hurt to call it anyway... And as someone already said, you have to call d3d_init again after a display mode change.

Login to post a reply

Server time is: 2024-04-25 08:08:56
Your offset time is: 2024-04-25 08:08:56