Text command overwriting
Blitz3D Forums/Blitz3D Beginners Area/Text command overwriting
| ||
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 |
| ||
you need "Cls" command. |
| ||
or double buffering... |
| ||
Both. |
| ||
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)... |
| ||
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] |
| ||
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 |
| ||
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. |
| ||
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 :) |
| ||
That would explain it! :) |
| ||
How the text was outside of the camera viewport and how you move it in? |
| ||
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. |
| ||
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. |
| ||
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. |
| ||
Hang on big10p, you say that setting up 3D graphics activates double buffering, but I thought that you have to say Graphics3D() sets up double buffering with the back buffer set as the draw buffer, but Graphics() draws straight to the front buffer. Try it. :) SetBuffer BackBuffer() otherwise everything will be front buffer. |
| ||
big10p: You are right about camera's view port. I missed that :( |