Home
Products
Community
Manuals
Contact
Login or Signup

"Black Screen" Problem with Graphics

BlitzMax Forums/BlitzMax Beginners Area/"Black Screen" Problem with Graphics

GuntiNDDS(Posted 1+ years ago) #1
Hi,

I am new to blitzmax. Looking at the examples I am experiencing a problem when setting the display mode, that I also had with DarkBasic before.

using for example:

Graphics 1024,768,32

the screen(s) will just go black and i have no option left except hitting the reset button on my computer. No ALT+F4, No Windows Key, No Alt+Tab can bring me back.

The Resolution and Depth is Supported by my graphics card and my primary and secondary screen. even tho the secondary screen should not matter anyways.

The Graphics Card is an ATI Radeon 4800 Series (i dont have the actual model # at hand)

In DB, the resolution to the problem i believe was to switch a setting from "fullscreen" to "Full desktop" through the IDE. After that i could change the resolution in code without the bug happening.

The Operation System is Windows 7 64 Bit Pro, even to (at least in DB) the problem also occoured under Windows Vista 64 Home Premium.


It is also noteworthy that i am an avid video game player and thus run alot of directx applications that all run fine.

Any ideas ? Thanks.


ImaginaryHuman(Posted 1+ years ago) #2
I am not sure if I'm going to make you sound like a total beginner, maybe I'm misunderstanding the problem... but basically when you call Graphics and you include a depth (32) it DOES and IS MEANT TO open a black screen. Depth of 0 opens in a desktop window. When in fullscreen mode it probably will disable certain keys/functionality of the operating system. On my Mac for example, fullscreen mode disables pretty much everything except perhaps volume and brightness keys. Things like alt-tab and such stop working. It's not a bug, in that sense. It's just that in fullscreen you can't expect to be able to play nice along with the operating system. If you want to your game to operate like a desktop application, open it in a desktop window ie Graphics 1024,768,0

A `bug` is something that is not working the way it is supposed to, or IS doing what you told it to do but you were mistaken. Sometimes bugs are in the mind ;-D


GuntiNDDS(Posted 1+ years ago) #3
Lol, yes sorry you misunderstood. What i meant is that it will go to a black screen and then dismiss the rest of the application, e.g. "Hangs up" or whatever you wanna call it.


GuntiNDDS(Posted 1+ years ago) #4
For Example when i run the "AStar"-Example that by default sets the display mode to 1024x768x32, i will JUST get a black screen and then nothing happens after that, and i cannot return "back".

if i change that to open it in a window, it runs normal.

i hope that makes it more clear.


Arowx(Posted 1+ years ago) #5
Have you got the latest graphics driver for your card?

Have you tried changing the default graphics driver with...
SetGraphicsDriver GLMax2DDriver()
'SetGraphicsDriver D3D7Max2DDriver()
'SetGraphicsDriver D3D9Max2DDriver()


It could be a DirectX driver issue?


GuntiNDDS(Posted 1+ years ago) #6
Well, i dont think its a directx or graphics driver issue per se, because all of my directx games and what not works fine.

i am guessing that the method darkbasic and blitzmax use to set the display mode in direct x is propably the same and that something in my setup conflicts with how they do that and that it is either related to the color depth or the refresh rate.


ImaginaryHuman(Posted 1+ years ago) #7
Does your graphics card support that resolution in fullscreen? do you have enough video ram? Can you open a 640x480 fullscreen? Do you have a widescreen monitor and does it support the resolution you want?


GuntiNDDS(Posted 1+ years ago) #8
This is my Primary Monitor:
------------------------------------
http://www.lge.com/de/it-produkte/tft-lcd-monitore/LG-W2600HP.jsp

This is my Graphics Card Details:
------------------------------------
Primary Adapter

Graphics Card Manufacturer
Powered by ATI

Graphics Chipset:
ATI Radeon HD 4800 Series

Device ID
9460

Vendor
1002

Subsystem ID
2700

Subsystem Vendor ID
1682

Graphics Bus Capability
PCI Express 2.0

Maximum Bus Setting
PCI Express 2.0 x16

BIOS Version
011.022.001.000

BIOS Part Number
113-HD489AZD10-002

BIOS Date
2009/04/24

Memory Size
1024 MB

Memory Type
GDDR5

Core Clock in MHz
900 MHz

Memory Clock in MHz
975 MHz

Total Memory Bandwidth in GByte/s
124,8 GByte/s


Theese are my supported display modes as reported by
BlitzMax's "GraphicsModes()"-Command:
------------------------------------

Available graphics modes:
640,480,32,59
640,480,32,60
640,480,32,75
720,480,32,60
720,480,32,75
720,576,32,60
720,576,32,75
800,600,32,60
800,600,32,75
848,480,32,60
848,480,32,75
1024,768,32,60
1024,768,32,75
1152,648,32,60
1152,864,32,60
1152,864,32,75
1280,720,32,60
1280,720,32,75
1280,768,32,60
1280,768,32,75
1280,800,32,60
1280,800,32,75
1280,960,32,60
1280,960,32,75
1280,1024,32,60
1280,1024,32,75
1360,768,32,60
1360,1024,32,60
1400,1050,32,60
1440,900,32,60
1600,1200,32,60
1680,1050,32,59
1680,1050,32,60
1920,1080,32,59
1920,1080,32,60
1920,1200,32,59
1920,1200,32,60

------------------------------------

I now know that it has something todo with the refresh rate indeed. If i tell BlitzMax to use 59hz, the bug does not appear and the application runs as expected.
However in that mode the mouse cursor behaves very jittery.
Also I should be able to run in 60hz fine.


GuntiNDDS(Posted 1+ years ago) #9
Actually my above statement is not entirely correct. in 59hz, it works but only in theese resolutions listed with 59hz support in the above list.


GuntiNDDS(Posted 1+ years ago) #10
Actually now thats also not entirely correct. For Example 640,480,32,59
also does not work.

This is a bit bad to test because i get to restart my computer every time and i am bit nervous about getting some memmory or hdd corruption out of all theese reboots.

i guess the question for me now is: on the directx level, what does say "Mass Effect" do different for setting the display mode compared to how blitzmax does it?


Jesse(Posted 1+ years ago) #11
it might also be your monitor not supporting certain frequency or resoution. In my pc when resolution can not be matched by my monitor it just shuts down.


GuntiNDDS(Posted 1+ years ago) #12
Apparently the monitor gets a problem with whatever happens on the directx level once blitzmax sets the display mode.
However this is not the issue.
It is not like i am trying to set a specifig resolution/frequency that will cause this bug. In effect i cannot set any fullscreen resolution using the Graphics-Method.

Even tho i admit i have not tried all of them (for reasons of trying to avoid issues from all the rebooting). I am however not trying to set any "stupid" resolutions. i know my monitor can display 800x600x32 at 60hz and 1920x1200x32 at 60hz. i can set theese manually in windows and they work, and off course they work in every game i currently have installed too.

this is really not the issue of my trying to set a resolution of ... 289x333 or something weired.

as posted above to me the question remains, what does a game like "mass effect" do differently when it tells directx to switch display mode to 1920x1200x32 compared to what blitzmax does.


Arowx(Posted 1+ years ago) #13
Have you tried changing the graphics driver blitzmax uses to DX7 and OpenGL?


GuntiNDDS(Posted 1+ years ago) #14
Yes. Using DX7 and OpenGL results in the same effect.

This is what I used to test:

'SetGraphicsDriver GLMax2DDriver()
SetGraphicsDriver D3D7Max2DDriver()

Graphics 1920,1200,32,60
While (Not KeyDown(KEY_ESCAPE))
Cls
DrawText "test",10,10
Flip
Wend
EndGraphics

This also helps determining that not only the screen gets unresposnive, but also one of two things also happen:
1) User input is not being recognized (Cannot quit with ESC)
2) User input is being recognized but quitting does not trigger the screen to revert back.

Also setting "Disable Composition Mode" and "Disable Visual Styles" on the compiled exe doesnt solve this either.


Arowx(Posted 1+ years ago) #15
Could you try the demo version of Qbix or mmjChallenge, linked in my sig, both games have a toggle full screen mode (800x600x32 res).

Both of these games were made with older versions of BlitzMax pre 1.36, so it might be worth trying an older version of BlitzMax e.g. 1.35 to see if it is just the current version of BlitzMax that has the issue.


GuntiNDDS(Posted 1+ years ago) #16
hi,
i have downloaded qbix. it started windowed, but then i set it to fullscreen through the options and it worked.


Arowx(Posted 1+ years ago) #17
Qbix was made with about a year ago so was probably pre 1.3 and uses the Dx7 and opengl drivers.

Excellent try downloading version 1.34 or earlier of BlitzMax from the accounts page, after backing up/renaming your 1.36 installation and try building that?

There have been a lot of changes to 1.35+ Dx9/Virutal Resoultions ect


GuntiNDDS(Posted 1+ years ago) #18
Hi,
with 1.34 the problem also occours.
(using the same code from above)


Arowx(Posted 1+ years ago) #19
OK try 1.30

If that still doesn't work try going back to 1.18

If that works try patching forward to find the best vesion


kenshin(Posted 1+ years ago) #20
Have you uninstalled/reinstalled the latest GFX card drivers and updated to the latest DirectX yet? Make sure you're using the reference drivers for your card too. Does your monitor have drivers available? Maybe they're needed. Have you tried using DriverCleaner?

It smells like drivers to me. Even though your other games are working fine, this is still the number one most likely cause of all your problems.


ziggy(Posted 1+ years ago) #21
It looks to me like an incompatible refresh rate. At 59 Hz it works... Are you using a CRT monitor? The card my be reporting it supports 60Hz but that does not mean the screen is able to show images at this rate.


skidracer(Posted 1+ years ago) #22
You don't mention using Ctrl-Alt-Delete as a way of shutting down your task.

Does DXdiag run all tests ok?

If you have followed these rules-

http://ati.amd.com/products/catalyst/top10-9.html

then God help you. I would consider an upgrade to nVidia - avid video game players tend to consider their cards superior from such experiences as yours.

For more pain, I would investigate badly configured IRQ in BIOS, testing with alternative monitor, uninstalling everything in your toolbar, and looking into vial-ware such as net-meeting that is known to cause hideous issues due to "innovative" virtual video graphics drivers.

Another serious third party problem encountered by Blitz users was Wacom tablet drivers that have only recently updated versions that do not introduce serious problems.

I would also consider testing your apps in release mode run from the desktop and not the IDE.


GuntiNDDS(Posted 1+ years ago) #23
-the drivers are the latest version.

-also i have the latest directx + the directx development pack or how you call it, that has all the directx versions

-i think it has todo with refresh rate too, but it does not work at 59hz, that was a misunderstandment

-i have not tested the earlier blitzmax versions yet, because "testing" does involve an inproper shutdown with every test and i'd like to avoid to keep doing that so i dont get hardware failures.
however aparantly something has changed since the earlier version in how the display mode is being engaged. also i must repeat that i play alot(!) of games, that ALL work fine ! so it is not a general error of my setup.

-regarding the "upgrade" to nvidia, i actually "upgraded" to ati a few months back, because nvidia didnt have a card that could do hdr and antialias at the same time, and actually i think ati is fine now.

if a developer could tell me how blitzmax engages the display mode change (e.g. what api call or dll call and with what parameters, i might then write an email to ati and ask them why that provokes the described behaviour? or if a developer could look back in the patch notes and find the entry where the display mode changing code was changed, so i dont have to damage my hardware


Arowx(Posted 1+ years ago) #24
@GuntiNDDS have you had any progress with older builds?

If we can work out which version work then we can check for differences in the source.

Or you can raise the issue with ATI regarding the driver problem!


GuntiNDDS(Posted 1+ years ago) #25
i am currently discussing the issue with ati support.

i will try not having to go through the older builds to avoid hardware damage from doing all the restarts, unless ati or someone else provides me with a "safe" test method.

still i'd be interested in the native function that blitzmax calls in order to set the display mode, and what parameters it provides to that function. might help the discussion with ati.

thanks for the input thus far.


theHand(Posted 1+ years ago) #26
You could try VirtualBox, but you would have to install your operating system "again" (it's a virtual computer). It is not slow because it can run code directly on the CPU just like the operating system already on your computer , but it might be weird with the ATI drivers (worked fine for me though, and I have an ATI card in mine) . When I change the display resolution in the Catalyst control center, the size of the VirtualBox window changes to reflect that.
VirtualBox is developed and supported by Sun Microsystems, the same people who develop Java.
It's worth a shot, and if it 'hangs' like before, you just restart the virtual machine, without having to touch your physical power/reset switch.
It's definitely worth a shot, it's free, and you have nothing to lose.

Also, I'm sorry for your woes, but thus is the life of a developer. T_T


Edit:
still i'd be interested in the native function that blitzmax calls in order to set the display mode

You're very likely going to have to get your hands dirty with C and become familiar with this if you want to make "native" calls to the display.


GuntiNDDS(Posted 1+ years ago) #27
Hi,

interesting idea but i dont see me going through this.
(VirtualBox)

As for the native call, i dont want to do it - i want to know what blitzmax does internal, so i can tell the ati guy something like "the application that provokes the error does <this> and then the issue appears".

The problem is that other applications and games work fine and thus the conversation with ati will propably end with them telling me its the fault of the application (Blitzmax). Therefore i would like being able to tell them more technical details.


theHand(Posted 1+ years ago) #28
Even if the problem lies with BlitzMax, the problem could be any number of things.
You would have to walk through hundreds of lines of code and know what they mean (I know what you're talking about (drivers)), because there are so many things that the problem could be, that the conflict(s) between the driver(s) BlitzMax uses and what your system has and how your system is set up could be. Mass Effect's method(s) of outputting graphics to the screen is buried within thousands and thousands of lines of code that is not accessible to non-employees of BioWare.

Also note that installing VirtualBox (or your operating system "again" (on VirtualBox)) will not install over what you have now, it will only take up additional hard drive space. Such a virtual machine is the only "safe" test method for things like this. It runs in a window, but the virtual machine is set up so that the VirtualBox operating system sees the display that is allocated to the VirtualBox program window as the entire display (thus making it easily manageable); that is any program running in fullscreen in the VirtualBox environment will take up just that window. It is a "separate" machine, in so far as operating systems are concerned (they're on the same hard drive of course, except you don't have to boot into it from poweroff, and in fact must run it from another OS). I hope this makes sense.




If you have followed these rules-

http://ati.amd.com/products/catalyst/top10-9.html

then God help you. I would consider an upgrade to nVidia

If you can't solve this, GuntiNDDS, then I believe you may have, as they say, slipped between the raindrops.


Arowx(Posted 1+ years ago) #29
Hi GuntilNDDS,

You could try the latest BlitzMax update 1.37 to see how if it works?


theHand(Posted 1+ years ago) #30
Sorry about the bump. I just wanted to say that I made several edits to my last two posts in this thread.


GuntiNDDS(Posted 1+ years ago) #31
Hey,

i been away for a while. Sorry for letting the topic slip, but i had other things in my head.

Latest Version 1.39 produces the same effect.

I have decided to just make windowed programs now since it doesnt seem that there is a solution or even explanation to the problem in sight and further testing comes along with risk of damages to my hardware.


B(Posted 1+ years ago) #32
i have never had a problem with using the cntrl-alt-delete, comand-option-esc for mac, and
going to processes and ending the blitzmax program.

i would think it was your code that was not properly working, but from other posts
i would ascertain that your coding prowess is fine.


sounds like a very annoying problem.

hope you get it fixed


GuntiNDDS(Posted 1+ years ago) #33
its not a problem of ctrl-alt-del not working. i am very certain that the problem is the monitor gets into an invalid display mode. i am also pretty certain it has todo with the refresh rate.
Unfortunitly i dont know enough of what happens behind the curtain when blitzmax tells directx to change the display mode and then what directx technically does. I suppose so there are different options of how this can be set in directx. For example using darkbasic, i can set a fullscreen display mode. So there must be someting db does differently from blitzmax when it tells dx to change the mode.


B(Posted 1+ years ago) #34
i used to program in darkbasic too actually.

i havent had any problem with either builds of darkbasic or blitzmax.

i am using the most recent build of blitzmax on both my:
macbook 2.4Ghz Intel Core 2 Duo
4 GB MHz DDR2 SDRAM
basic hardware accelerated graphics card
Intel GMA X3100

and my very old IBM T40
1.6 Ghz
1 GB Ram
basic crappy graphics card

and they both work fine.

i wonder if your monitor is just a lemon or something

i know that both darkbasic and blitzmax use directX in the same way.

they talk to directx and directx talks to the graphics card.
ever since directx 9 (i think) directx will check the capabilities of your computer to see
if it is able to to what you are asking of it (hardware wise) which makes it easier since
you dont have to do it yourself in your code.
if your hardware is unable to do what you are asking of it directx will emulate it via
software so that you can still do it. this will drop your fps rate and works better with
lower resolutions and depth but still allows you to do it.

there could be a problem with the way blitzmax is talking to directx compared to mass effect as you stated above.
i dont know how they differ in that aspect, but im sure that mass effect stream lined the
way in which it talks to directx. altho at this point im just speculating.

if anyone could clarify anymore than i have, (which is not much i assume) that would be
great.

now i am really interested in this problem.

hope i helped, even just a little bit


GuntiNDDS(Posted 1+ years ago) #35
Hi.

Well you can see my graphic card and monitor above in the thread. Both are not very exotic in my oppinion :D

What i mean with how blitz and db may talk to directx differently is:
(this is all speculation)
possibly the method that initializes the display mode in directx has overloads or optional parameters. for example it might be possible to tell it only width and height and colordepth, and optionally it could be told the frequency/refresh rate too. Maybe DB passes only the optional parameter to it if it is specified in the DB program, whilest maybe blitz allways passes that parameter based on a default value it retrieves via some windows api or vice versa.
this is kind of the difference there could be, that i mean and that could cause the problem.


B(Posted 1+ years ago) #36
i think that in both blitzmax and db if you do not specify refresh rate it will attempt
the highest that your system can support.

but ya there are probly many more things that are happening that could cause
problems that i am not aware of.

good luck with solving your problem.

if i find anything that might be of use i will be sure to post it here


SLotman(Posted 1+ years ago) #37
Have you tried something like:

Graphics(DesktopWidth(),DesktopHeight(),DesktopDepth(),DesktopHertz(0),GRAPHICS_BACKBUFFER)
(you may need to use chaos.desktopext on some versions of blitzmax for that to work)

If that doesn't work, then for sure there's a problem in your system, be it the monitor, the drivers or whatever.

As for seeing 'the calls' done by blitzmax, you can check out the source yourself, it's included on every bmax copy. Look under /mod/brl.mod/ and see specially d3d7max2d.mod/dxgraphics.mod and glmax2d.mod/glgraphics.mod.

But I really don't think this is a problem with the way bmax calls DX or OGL - it's pretty standard. What bugs me the most is this 59hz thing. That's not usual refresh rate - usually you get 50hz, 60hz, 75hz... but 59?

Have you installed the drivers for your monitor? Maybe if you didn't, Windows could be not detecting refresh rates correctly...


GuntiNDDS(Posted 1+ years ago) #38
the 59hz things has todo with how it is mathematically rounded. my monitor is 60hz, but technically it is like 59.9xx hz. Windows rounds this down to 59hz instead of up to 60hz.
(yes i have the monitor drivers installed)

what bugs me is that i run alot of directx applications/games and i only have this problem with blitzmax.


B(Posted 1+ years ago) #39
you could try reinstalling the latest version of directx and then reinstalling blitzmax and rebuilding all the modules.


GuntiNDDS(Posted 1+ years ago) #40
Got latest version of directx and also just a few days ago reinstalled blitzmax.

I wrote another test program today with an interesting result. (Also updated to lastest ATI driver again)

This is the test program i wrote:

Graphics 800, 600, 0
SetClsColor(255, 0, 0)
Cls
Flip(0) 
DrawOval(0, 0, 500, 500)
Flip(0)
WaitKey()

Graphics(DesktopWidth(), DesktopHeight(), DesktopDepth(), DesktopHertz(), GRAPHICS_BACKBUFFER)
SetClsColor(0, 255, 0)
Cls
Flip(0)
DrawOval(0, 0, 500, 500)
Flip(0)
WaitKey()

Graphics 800, 600, 0
SetClsColor(255, 0, 0)
Cls
Flip(0)
WaitKey()
End


the expected behavior on a machine not affected by my problem is:

1) 800x600 sized window, screen goes red with white oval on it
After Keypress:
2) Screen goes fullscreen to desktop-specification, screen goes green with white oval on it
After Keypress:
3) Goes back to 800x600 window with red screen
After Keypress:
4) Quits

the expected behavior on my machine is:

1) 800x600 sized window, screen goes red with white oval on it
After Keypress:
2) Screen goes and stays black - Computer needs restart

however, the actual behavior now is this:

1) 800x600 sized window, screen goes red with white oval on it
After Keypress:
2) Screen goes fullscreen to desktop-specification, screen goes green with white oval on it
After Keypress:
3) Screen goes and stays black - Computer needs restart

So the issue is now more similiar to the issue with DarkBasic, where the screen "freezes black" at the END or so to say "when the program tries to revert BACK from the fullscreen mode".


B(Posted 1+ years ago) #41
sorry for the late reply, college is kicking my butt.

that is quite an interesting result, you could try refreshing the memory in between
Graphics width,height,etc... cmd usage.
there was a command for it in DB, but i do not know its counter part in blitz.

I would not know why you are having that problem.

I never need to use that many graphics calls in 1 program tho.

I am going to run that code right now.

EDIT: ran fine on my macbook and my ibm
tho i changed the DesktopWidth() cmd to the actual res of my desktop
because that cmd was not found for me.

have you tried using the Endgraphics cmd after each graphics call?


SLotman(Posted 1+ years ago) #42
Try calling EndGraphics after each waitkey and see if it helps... and be sure to test it with opengl, dx7 and dx9 - if all of them fails the same, you can be sure the problem isn't with bmax :P

and why are you doing a flip after cls, and another after drawing the circle? Just do it like this:

Graphics 800, 600, 0
SetClsColor(255, 0, 0)
Cls
DrawOval(0, 0, 500, 500)
Flip
WaitKey
EndGraphics

Graphics(DesktopWidth(), DesktopHeight(), DesktopDepth(), DesktopHertz(), GRAPHICS_BACKBUFFER)
SetClsColor(0, 255, 0)
Cls
DrawOval(0, 0, 500, 500)
Flip
WaitKey
EndGraphics

Graphics 800, 600, 0
SetClsColor(255, 0, 0)
Cls
Flip
WaitKey
EndGraphics
End



GuntiNDDS(Posted 1+ years ago) #43
Hmm. It seems that calling EndGraphics does the trick.

Thanks !

I hadn't thought I would ever get this solved.


B(Posted 1+ years ago) #44
no prob.

glad you did.


coffeedotbean(Posted 1+ years ago) #45
This is a realy late reply but OP is using an ATI card, is he running the "D3dOverider" tool/hack to force v-sync on some games? there will be a system tray icon for it. Most gamers will have this.

I cannot run any blitzmax game in full screen with this enabled, I get a black screen and its almost like it has hung. Ctrl+alt+del works after a few tries though. (windows 7)


Chugs40(Posted 1+ years ago) #46
Also a late reply, and someone's probably already mentioned this ...

Are you drawing and then capturing images? Sometimes it's as simple as setting the blend mode and colors to 255,255,255, and alpha to 1. I've had problems with this before. Also, enabling a graphics driver in your code will do the trick - sometimes on your machine but not everyone else's.

I'm not sure what your doing, but if capturing images make sure to include DYNAMICIMAGE in your image flags.

Also maybe try different flipping policies, like FLIP(1) - Just a thought.