Help-Concept clarification
Blitz3D Forums/Blitz3D Beginners Area/Help-Concept clarification
| ||
Elementary..so I thought.. Just trying to vary the back color.. simple: use the ClsColor/Cls combination ..oops.. I obviously do not understand some basic concept with B3D.. code: Graphics3D 1024,768,16,2 SetBuffer BackBuffer() ;<--- Build in backbuffer ClsColor 255,0,0 ;red ;<-- next cls sets curr buff to clr Cls ;<--- set the backbuffer to red cam=CreateCamera() cube=CreateCube() light=CreateLight(1,cam) PositionEntity cam,0,0,-5 ;CameraClsColor cam,255,0,0 ;<---- must have ??? While Not KeyDown(1) TurnEntity cube,.500,.000,.0 If KeyDown (208) MoveEntity cam, 0, 0, 0.1 If KeyDown (200) MoveEntity cam, 0, 0, -0.1 UpdateWorld() ;WaitKey() ;<------ screen is red before render RenderWorld() ;<---- turns black ??? ;WaitKey() Flip If KeyDown(203) TurnEntity cam,0,3,1 If KeyDown(205) TurnEntity cam,0,-3,-1 Wend End ==== In Playing with it.. the RenderWorld shows the background as black unless the cameraClsColor is used... I simply wanted to show a cube on a red background..What is happening ? |
| ||
Kurtz you are mixing 2D and 3D commands. The cls sets the background red but when u renderworld, the results paste over the red background. Think the command u r after is cameraclscolor Update- Reading your post a bit closer - you figured it out by yourself anyways! You can lose the clscolor and cls commands before the renderworld |
| ||
@Ram-Thanks.. So the concept I am not understanding is: In 3d the "scene" (Cubes etc..) is NOT being drawn on the BACKBUFFER rather "somewhere(?)" else.. the RenderWorld Puts the "Scene" onto the backbuffer and the FLIP sends the backbuffer to the frontbuffer (visible screen)... Am I close ? |
| ||
Hey man, use camerclsmode. This stops renderworld from deleting anything prevoius on the screen. Say you draw a rectangle, then call renderworld, the rectangle will get deleted. BUT if you use cameraclsmode, then you can make renderworld not clear the backbuffer before rendering, so your rectangle will still be in view. You must however use cls at the top of each loop, or you'll get the stuff from the last loop appearing in the backround :) |
| ||
You could try to use the CameraViewPort command.Graphics3D 1024,768,16,2 SetBuffer BackBuffer() ;<--- Build in backbuffer ClsColor 255,0,0 ;red ;<-- next cls sets curr buff to clr Cls ;<--- set the backbuffer to red cam=CreateCamera() cube=CreateCube() light=CreateLight(1,cam) PositionEntity cam,0,0,-5 ;CameraClsColor cam,255,0,0 ;<---- must have ??? CameraViewport cam, 100, 100, 824, 568 ; <----------- use this to give it a try While Not KeyDown(1) TurnEntity cube,.500,.000,.0 If KeyDown (208) MoveEntity cam, 0, 0, 0.1 If KeyDown (200) MoveEntity cam, 0, 0, -0.1 UpdateWorld() ;WaitKey() ;<------ screen is red before render RenderWorld() ;<---- turns black ??? ;WaitKey() Flip If KeyDown(203) TurnEntity cam,0,3,1 If KeyDown(205) TurnEntity cam,0,-3,-1 Wend End If you add the CameraViewPort command (see code), you can actually see that the backbuffer is still red, like stated in the ClsColor command. (Using the above code will give you a smaller portion of the screen that's rendered, with a red outline around it) The only reason the screen goes black, is that the camera has a standard black background where it sees nothing. And those black parts of the screen overlap the red background color. |
| ||
Kurtz- yeah you got it - the scene is not actually drawn at all until you renderworld. |