graphics command

Blitz3D Forums/Blitz3D Beginners Area/graphics command

Kairu(Posted 2010) [#1]
im confused as to what the limitations are and what the w and h are measured in. and how can i maximize the quality in the graphics of my game?


Kalisme(Posted 2010) [#2]
I'm a bit confused by the question (please excuse me; I'm half asleep), but you're talking about the graphics command as in:

graphics 320,240,16,2

that's what you mean, right? The command for setting up the 2d graphics so you can make imagery on the screen? Well, I guess you mean "graphics3d" command because this is the blitz3d forum (they both can do 2d commands, but any 3d commands require the graphics3d command).

Anywho, the height and width of the screen is measured in pixels.
If you are using fullscreen mode you will have to set the H & W to a standard resolution...
eg:
320 x 240
640 x 480
800 x 600
...oh, for anything higher you can just check what windows allows you to change the screen resolution to...

Just look up the command in the blitz command reference, they explain it quite well.

Hmmm... I don't know if i answered your question at all, but i hope i was some help.


Yasha(Posted 2010) [#3]
The first two parameters are measured in pixels: this will affect the size of the final image. In windowed mode they can be pretty much whatever you want (mostly, might not always work on some systems), while in fullscreen mode they generally have to be supported by your graphics setup (which is why it's important to let the end user choose these, later). 3:4 ratios (800x600, 1024x768) are generally universal, and nowadays most people will support 16:9 or 16:10 (1440x900 yay!) as well. The maximum limit is 2048x1536, but you're unlikely to need this. 800x600 or 1024x768 are good default resolutions (don't use 640x480; it's increasingly unsupported by modern systems, and looks terrible anyway).

The third parameter is the colour depth. In windowed mode, this has no effect and the graphics window will use the same colour depth as your windows desktop. In fullscreen mode, set this to 0 to let the system choose which colour depth to use, or set it to 32. There are almost no circumstances where you'd want it to be anything other than 32, and using a lower value will decrease the graphics quality and may decrease performance as well, on most modern cards (read: anything made in the last ten years. No excuse for not supporting this!).

The fourth parameter is the display mode. Mode 0 will use either fullscreen or windowed depending on whether you're compiling in debug or release mode (I would avoid this one). Mode 1 is for fullscreen. Mode 2 is for windowed mode. Mode 3 allows the user to scale the window. Mode 6 (there are no modes 4 or 5) is windowed, but suspends the application if you tab to something else (this is useful). Mode 7 is like 3 but also allows auto-suspending.

The important thing to remember about these is that there may be significant visual differences between fullscreen and windowed mode, and you can't assume that what looks good in one will look good in the other, so remember to test both before deploying an app. Modes 1 and 6 are therefore the most useful.

All of the above is the same between Graphics and Graphics3D. Graphics3D allows you to use 3D, but still has full 2D functionality.


Kryzon(Posted 2010) [#4]
Nice post, Yasha.


Kairu(Posted 2010) [#5]
wow. thank you soo much yasha. that explains why my game wont play on my brothers newer laptop.


Warner(Posted 2010) [#6]
To find out which modes are supported, use GFXModeExists.


_PJ_(Posted 2010) [#7]
It's all here:
http://www.blitzbasic.com/b3ddocs/command.php?name=Graphics&ref=2d_a-z


Serpent(Posted 2010) [#8]
One more thing. Personally I've had severe problems in the past regarding using the BackBuffer in windowed mode.

Read this post from Floyd - there are a few useful things to remember:
There are at least three things to consider.

Print always draws to the front (visible) buffer. You should use Text, which is a graphics command.

Another problem is that there really is no back buffer in windowed mode. In fullscreen you have a true back buffer in addition to the front buffer. Flip just changes which of these is used for the screen display. That is impossible in windowed mode because your program is not in charge of the entire screen. Instead, Blitz tries to fake this functionality. It maintains a buffer for its own use, drawing to this rather than a real back buffer. The Flip command then copies from this buffer to the on-screen window.

Finally, keep in mind that immediately after a Flip the contents of the back buffer, which used to be the front buffer, are undefined. They may be the old front content, undisturbed. Or the memory might get cleared. Or it might be corrupted in some way, perhaps being used as some kind "scratchpad" memory. This is determined by the graphics card and driver. If you draw to both buffers and simply flip between them you get unpredictable results. What works for you may be quite different on another computer