Brauche Hilfe bei Fehlermeldung...
Verfasst: 24.12.2008 15:52
Error: Openscreen must be called before using any 3d commands.
Wo setze ich den Openscreen?
danke.
mfg
Wo setze ich den Openscreen?
danke.
mfg
Code: Alles auswählen
#PB_Node_Node = 1
#PB_Node_Entity = 2
#CameraSpeed = 5
#NBNode = 2
#NbBranche = 2
Define.l i, j
Dim entity(#NbBranche, #NBNode)
Dim Node(#NbBranche, #NBNode)
Enumeration
#Window_0
EndEnumeration
OpenWindow(#Window_0, 0, 0, 450, 320, "Test",
#PB_Window_SystemMenu | #PB_Window_SizeGadget |
#PB_Window_TitleBar )
Define.f KeyX, KeyY, MouseX, MouseY
InitEngine3D()
Add3DArchive("Data\" , #PB_3DArchive_FileSystem)
InitSprite()
InitKeyboard()
InitMouse()
CreateMesh(0, 100)
SetMeshData(0, #PB_Mesh_Vertex | #PB_Mesh_Normal |
#PB_Mesh_Color, ?CubeData2, 8)
SetMeshData(0, #PB_Mesh_Face, ?CubeDataIndex, 12)
CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
MaterialAmbientColor(0, #PB_Material_AmbientColors)
d=25
For j = 0 To #NbBranche
Node(j, 0) = CreateNode(#PB_Any,0,0,0)
Entity(j, 0) = CreateEntity(#PB_Any, MeshID(0), MaterialID(0))
ScaleEntity(Entity(j, 0),0.5,0.5,1)
AttachNodeObject(Node(j, 0),EntityID(Entity(j, 0)),#PB_Node_Entity)
MoveEntity(entity(j, 0), 0, 0, d)
For i = 1 To #NBNode
Node(j, i) = CreateNode(#PB_Any,0,0,0)
MoveNode(Node(j, i), 0, 0, d)
AttachNodeObject(Node(j, i-1),NodeID(Node(j, i)),#PB_Node_Entity)
entity(j, i) = CreateEntity(#PB_Any, MeshID(0), MaterialID(0))
ScaleEntity(Entity(j, i),0.5,0.5,1)
AttachNodeObject(Node(j, i),EntityID(Entity(j, i)),#PB_Node_Entity)
MoveEntity(entity(j, i), 0, 0, d)
Next i
Next j
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0, 0, 0, 250)
CreateLight(0,RGB(255,255,255),0,500,0)
AmbientColor(RGB(85,85,85))
Repeat
ClearScreen(RGB(0, 0, 0))
ExamineKeyboard()
ExamineMouse()
For j = 0 To #NbBranche
RotateNode(Node(j, 0), 360.0/(#NbBranche+1) * j + (MouseX()/2),(45-(MouseY()/8)), 0)
For i = 1 To #NBNode
RotateNode(Node(j, i), 0,45-(MouseY()/8),0)
Next i
Next j
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
End
#SQRT13 = 0.57735026
DataSection
CubeData2:
Data.f -10.0,10.0,-10.0 ; 0 position
Data.f -#SQRT13,#SQRT13,-#SQRT13 ; 0 normal
Data.l 255 ; 0 colour
Data.f 10.0,10.0,-10.0 ; 1 position
Data.f #SQRT13,#SQRT13,-#SQRT13 ; 1 normal
Data.l 255 ; 1 colour
Data.f 10.0,-10.0,-10.0 ; 2 position
Data.f #SQRT13,-#SQRT13,-#SQRT13 ; 2 normal
Data.l 255 ; 2 colour
Data.f -10.0,-10.0,-10.0 ; 3 position
Data.f -#SQRT13,-#SQRT13,-#SQRT13 ; 3 normal
Data.l 255 ; 3 colour
Data.f -10.0,10.0,10.0 ; 4 position
Data.f -#SQRT13,#SQRT13,#SQRT13 ; 4 normal
Data.l 255 ; 4 colour
Data.f 10.0,10.0,10.0 ; 5 position
Data.f #SQRT13,#SQRT13,#SQRT13 ; 5 normal
Data.l 255 ; 5 colour
Data.f 10.0,-10.0,10.0 ; 6 position
Data.f #SQRT13,-#SQRT13,#SQRT13 ; 6 normal
Data.l 255 ; 6 colour
Data.f -10.0,-10.0,10.0 ; 7 position
Data.f -#SQRT13,-#SQRT13,#SQRT13 ; 7 normal
Data.l 255 ; 7 colour
CubeDataIndex:
Data.w 0,2,3
Data.w 0,1,2
Data.w 1,6,2
Data.w 1,5,6
Data.w 4,6,5
Data.w 4,7,6
Data.w 0,7,4
Data.w 0,3,7
Data.w 0,5,1
Data.w 0,4,5
Data.w 2,7,3
Data.w 2,6,7
EndDataSection