Text command overwriting

Blitz3D Forums/Blitz3D Beginners Area/Text command overwriting

doctorjeff98(Posted 2008) [#1]
When using a Text command, the letters are overwriting themselves so it's a jumbled mess when the second message is displayed. How do I get the letters to erase the old letters then place the new ones? Below is my main game loop.

I thought all I had to do was place the Text command after Renderworld but before Flip.

While Not KeyHit( escape_key )

control_with_arrows( camera_pivot )


UpdateWorld

RenderWorld

; 2D here
;display_message(uniquephrases(Rnd(0,19)));

If (Rnd(0,1000) > 900) Then Text 10, screen_height-message_height+5, "> " + uniquephrases(Rnd(0,19))

Flip
Wend


markcw(Posted 2008) [#2]
you need "Cls" command.


Moraldi(Posted 2008) [#3]
or double buffering...


Sledge(Posted 2008) [#4]
Both.


big10p(Posted 2008) [#5]
RenderWorld does it's own Cls (unless you specifically tell it not to). Also, double buffering is automatically set up when setting a 3D graphics mode. There must be more to this story (code)...


Sledge(Posted 2008) [#6]
RenderWorld does it's own Cls
Good point.

Also, double buffering is automatically set up when setting a 3D graphics mode
Yeah alright -- don't get carried away with the good pointage :P

There must be more to this story (code)...
I had someone report that one of my daft lil' demos wasn't cls'ing on their machine -- I did a new version that manually blit a giant black rectangle instead and that worked for him. I think Vista may have been involved. [sounthern_drawl]That true doctorjeff98? You a Vista lover?[/sounthern_drawl]


Moraldi(Posted 2008) [#7]
doctorjeff98:
I suppose you have already created a camera, right?
Otherwise your text output will be messed up
The code bellow works as you expected before:
Graphics3D 800,600

SetBuffer BackBuffer()

camera = CreateCamera()

i% = 0

While Not KeyHit(1)

	i = i + 1
	UpdateWorld
	RenderWorld()
	Text 100, 100, i
	Flip

Wend


You can rem the second line... big10p has right


big10p(Posted 2008) [#8]
If it's not something obvious, it must be a driver/OS issue, as Sledge mentions.

I've never experienced this before myself, though - the code posted by the OP should work fine.


doctorjeff98(Posted 2008) [#9]
I am a Vista lover, but that wasn't the problem.

The above demo worked fine; so I explored more and found my error.

The text was outside of the camera viewport---oops. when I moved it into the camera viewport it worked fine :)


big10p(Posted 2008) [#10]
That would explain it! :)


Moraldi(Posted 2008) [#11]
How the text was outside of the camera viewport and how you move it in?


big10p(Posted 2008) [#12]
Moraldi: you can set the camera viewport to any rect on the screen - it doesn'y have to be the entire screen. RenderWorld only does a Cls on the defined viewport.


Blitz123(Posted 2008) [#13]
Hang on big10p, you say that setting up 3D graphics activates double buffering, but I thought that you have to say
SetBuffer BackBuffer()
otherwise everything will be front buffer.


jfk EO-11110(Posted 2008) [#14]
I remember I had troubles without Setbuffer Backbuffer() on some graphics cards and/or directX versions. THere may also be a diffrence between windowed and fullscreen mode, since windowed uses a pseudo 2-buffer system. So better be on the save side.


big10p(Posted 2008) [#15]
Hang on big10p, you say that setting up 3D graphics activates double buffering, but I thought that you have to say
SetBuffer BackBuffer()
otherwise everything will be front buffer.
Graphics3D() sets up double buffering with the back buffer set as the draw buffer, but Graphics() draws straight to the front buffer. Try it. :)


Moraldi(Posted 2008) [#16]
big10p:
You are right about camera's view port. I missed that :(