rendorworld erases my viewport

Blitz3D Forums/Blitz3D Programming/rendorworld erases my viewport

Amanda Dearheart(Posted 2012) [#1]
I'm trying to create an onscreen debug console to track some variables using the viewport command

I'm using the viewport command as suggested in the manual like these

viewport 700, 600, width, height to setup the view

Text ;;;;
Text ;;;;

viewport 0,0, width, height to close the window

then I finally flip the graphics to the front buffer.

But when I use the renderworld and updateworld to display the 3d graphics, they wipe my viewport out of existence. I, of course, wish my viewport to always be there.


Zethrax(Posted 2012) [#2]
You need to draw any 2D graphics between the RenderWorld and Flip commands.

eg.
UpdateWorld
RenderWorld
; Draw your 2D graphics here.
Flip


Floyd(Posted 2012) [#3]
I never had much use for the viewport but I've often put debugging information on screen. Just draw text to the screen after RenderWorld.

If you are feeling ambitious then write a more flexible routine to allow arbitrary size and position for the "console" region. I normally go the quick and dirty route to get some information on screen, fix a problem and then get rid of the debug console.

Graphics3D 1200, 800, 0, 2
WireFrame True
HidePointer

cam = CreateCamera()
PositionEntity cam, 0, 0, -2

sph = CreateSphere()
EntityColor sph, 255, 0, 0

While Not KeyDown(1)
	TurnEntity sph, 0, 0.1, 0
	RenderWorld
	Show_Console
	Flip
Wend

Function Show_Console( )
	Color 0, 0, 100
	Rect 0, 600, 500, 300 
	Color 255, 255, 0
	Text 20, 620, "Useful information could appear here."
End Function



Amanda Dearheart(Posted 2012) [#4]
Thanks guys!


Yasha(Posted 2012) [#5]
Um, I'm not sure I understand your original question, but it's also worth pointing out that Viewport isn't the same as CameraViewport: I don't think Viewport affects 3D rendering in any way.