More Than One Graphics Window?

BlitzMax Forums/BlitzMax Programming/More Than One Graphics Window?

zoqfotpik(Posted 2014) [#1]
How do I open more than one window for graphics? This is primarily for debugging purposes. Is there a way?


Brucey(Posted 2014) [#2]
You probably want to use something like MaxGUI, and create multiple canvases.


zoqfotpik(Posted 2014) [#3]
All righty.

How do you know so much?


Ferret(Posted 2014) [#4]
How do you know so much?

A:Its Brucey
B:Big brain
C:Memory implants


col(Posted 2014) [#5]
to open more than one graphics window you simple keep a copy of the return value from the Graphics command then when you want to 'send' max2d commands to specific window you use the SetGraphics command. No need for maxgui at all, unless of course you want to.

It doesnt work for fullscreen modes though as each TGraphics variable will generally have exclusive access to the display device, it only works for windowed modes.


xlsior(Posted 2014) [#6]
If you're using OpenGL, make sure to also call GLShareContexts() before opening the graphics windows, or you won't be able to draw the same images to both.


zoqfotpik(Posted 2014) [#7]
Col: Sweet. Unfortunately the window appears to vanish and I get an exception error if I try to setgraphics to either window after the initial calls:

window1:tgraphics = Graphics (640,480)
window2:tGraphics = Graphics (640,480)

SetGraphics window1
SetGraphics window2



I don't know what it is that I like about blitzmax so much but I just love it.


col(Posted 2014) [#8]
My apologies you need CreateGraphics not Graphics.
Try this...

Strict

Local window0:tgraphics = CreateGraphics(500,500,0,0,0)
Local window1:tgraphics = CreateGraphics(500,500,0,0,0)

enablepolledinput

SetGraphics window0
SetClsColor 60,120,180
SetColor 255,0,0

SetGraphics window1
SetClsColor 0,6,60
SetColor 0,255,0

Global ang#
While Not KeyDown(key_escape) Or AppTerminate()
	SetGraphics window0
	Cls
	SetRotation -ang
	DrawText "Window0",30,30
	
	Flip
	
	SetGraphics window1
	Cls
	SetRotation ang
	DrawText "Window1",30,30
	
	Flip
	
	ang :+ 1
Wend



zoqfotpik(Posted 2014) [#9]
Thank you very much, it will help greatly for troubleshooting AI and other things.