InitEngine3D problem on AsusEeePC 1024x600 XP/Home

Just starting out? Need help? Post your questions and find answers here.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: InitEngine3D problem on AsusEeePC 1024x600 XP/Home

Post by Danilo »

endo wrote:I just tested on my work PC, same result! So the problem is not about the PC or there is no problem at all.
ClearScreen doesn't behave as *expected* if InitEngine3D is used.
It is the same on MacOSX. Does it work with CreateCamera() and CameraBackColor() on your AsusEeePC 1024x600@32? Looks like this is the way to go.
Should work cross-platform and with all sub-systems.
endo wrote:Edit: I just realized that when InitEngine3D is used drawing directly onto screen is (may?) not working:

Code: Select all

InitEngine3D(): InitSprite(): InitKeyboard(): OpenScreen(800,600,32,"")
Repeat
  If StartDrawing(ScreenOutput())   ; <<--- "The specified output is NULL" error!
    DrawText(120,80,"Hello world!")
    StopDrawing()
  EndIf
Until KeyboardPushed(#PB_Key_Escape)
Known issue. Search for ScreenOutput Null
Last edited by Danilo on Wed Dec 11, 2013 7:30 pm, edited 1 time in total.
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: InitEngine3D problem on AsusEeePC 1024x600 XP/Home

Post by Samuel »

endo wrote:I just tested on my work PC, same result! So the problem is not about the PC or there is no problem at all.
ClearScreen doesn't behave as *expected* if InitEngine3D is used.

Edit: I just realized that when InitEngine3D is used drawing directly onto screen is (may?) not working:
I mentioned that a little bit earlier. If you wish to draw to the screen. You will first need to draw to a sprite then draw that sprite onto the screen.

Here's a little example drawing a sprite to the screen. You can move around with the mouse and arrow keys.
Notice how the red box stays in place while the 3D world moves around.

Code: Select all


InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()

Define.f KeyX, KeyY, MouseX, MouseY

OpenScreen(800,600,32,"")

;#### Creating the Sprite and drawing a red box on it.
CreateSprite(1,256,256,#PB_Sprite_AlphaBlending)
  StartDrawing(SpriteOutput(1))
    Box(0,0,256,256,RGB(255,0,0))
  StopDrawing()
;####

;#### Setting up 3D world.
  CreateTexture(1,32,32)
  StartDrawing(TextureOutput(1))
    Box(0,0,32,32,RGB(0,255,155))
  StopDrawing()
  CreateMaterial(1,TextureID(1))
  
  CreateTexture(2,32,32)
  StartDrawing(TextureOutput(2))
    Box(0,0,32,32,RGB(0,0,255))
  StopDrawing()
  CreateMaterial(2,TextureID(2))
  
  CreateSphere(1,16,16,32)
  CreateEntity(1,MeshID(1),MaterialID(1))
  
  CreatePlane(2,1000,1000,1,1,1,1)
  CreateEntity(2,MeshID(2),MaterialID(2),0,-40,0)
  
  CreateLight(1,RGB(255,255,255),50,50,50)
  CreateCamera(1,0,0,100,100)
  MoveCamera(1,0,100,200,#PB_Absolute)
  CameraLookAt(1,0,0,0)
  CameraBackColor(1,RGB(100,100,100))
  
  WorldShadows(#PB_Shadow_Modulative,600,RGB(200,200,200))
  
Repeat
      If ExamineMouse()
        MouseX = -MouseDeltaX()/20
        MouseY = -MouseDeltaY()/20
      EndIf
      
      If ExamineKeyboard()
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -0.5
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = 0.5
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -0.5
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = 0.5
        Else
          KeyY = 0
        EndIf
      EndIf
      
  RotateCamera(1, MouseY, MouseX, 0, #PB_Relative)
  MoveCamera  (1, KeyX, 0, KeyY)
      
  RenderWorld()
;#### You must display the sprite evertime after RenderWorld() otherwise it will be covered up by the 3D world.
  DisplayTransparentSprite(1, 400, 300 , 155)
  FlipBuffers()
  
Until KeyboardPushed(#PB_Key_Escape)

Post Reply