Graphics3D width,height[,depth][,mode]
Parameters
|
width - width of screen resolution height - height of screen resolution depth (optional) - colour depth of screen; 0 (default) uses the highest colour depth available mode (optional) - mode of display 0: windowed (if possible) in debug mode, fullscreen in non-debug mode (default) 1: fullscreen always 2: windowed always 3: windowed and scaled always 6: windowed, with auto-suspend when the window loses focus 7: windowed and scaled, with auto-suspend when the window loses focus |
Description
|
Sets 3D graphics mode. This command must be executed before any other 3D command, otherwise programs will return an error. Width and height set the resolution of the screen or window. In fullscreen modes the resolution must be one the graphics card and monitor support - check with GfxModeExists rather than hard-coding an exotic size. Classic values are 640,480 and 800,600; modern desktop sizes such as 1920,1080 work too. Depth sets the colour mode of the screen. If omitted or 0, the highest available colour depth is used - the right choice for almost every program. Values of 16, 24 and 32 request specific depths: 16-bit mode displays the fewest colours (65536) and mainly matters when reproducing retro banding and dithering behaviour. The scaled window modes (3 and 7) keep the drawing resolution you asked for and stretch it to fit the window - useful for a fixed-resolution game on a big desktop. Use plain Graphics instead for 2D-only programs, and EndGraphics to close the display down. See also: Graphics, EndGraphics, GfxModeExists, Windowed3D. |
Example
; Graphics3D Example ; ------------------ ; Graphics3D width,height,depth,mode sets up 3D graphics. ; Depth 0 picks the best colour depth; mode 2 always opens a window. Graphics3D 640,480,0,2 ; Draw to the back buffer; Flip then shows each finished frame SetBuffer BackBuffer() ; Every 3D scene needs a camera... camera=CreateCamera() PositionEntity camera,0,1,-5 ; ...and a light, or everything appears flat light=CreateLight() RotateEntity light,45,45,0 ; A spinning cone so there is something to see cone=CreateCone(16) PositionEntity cone,0,1,0 EntityColor cone,255,100,0 ; The classic Blitz3D main loop While Not KeyDown(1) TurnEntity cone,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Arrow keys: move camera Esc: exit" Text 0,20,"Graphics3D 640,480,0,2 - windowed 640x480 3D display" Flip Wend End
Index