Have you changed what I told you to? Set fixed resolution instead of those 2 lines.
Code: Select all
Macro Check(Status, Error, EndProgram = 1)
If Not Status
MessageRequester("ERROR", Error)
CompilerIf EndProgram
End
CompilerEndIf
EndIf
EndMacro
Structure MeshVertex
X.f
Y.f
Z.f
EndStructure
Structure MeshNormal
X.f
Y.f
Z.f
EndStructure
Structure MeshColor
RGB.l
EndStructure
Structure MeshUV
U.f
V.f
EndStructure
Structure MeshFace
V1.i
V2.i
V3.i
EndStructure
Procedure.i CreateMeshEx(Mesh.i, *PointerVertex.MeshVertex, *PointerColor.MeshColor, *PointerNormal.MeshNormal, *PointerUV.MeshUV, *PointerFace.MeshFace, Vertices.i, Faces.i)
Protected K.i
Protected MeshNumber.i
Protected Result.i = 0
If *PointerVertex = #Null Or *PointerFace = #Null
ProcedureReturn Result
EndIf
If Mesh = #PB_Any
MeshNumber = CreateMesh(Mesh)
Result = MeshNumber
Else
Result = CreateMesh(Mesh)
MeshNumber = Mesh
EndIf
If Result <> 0
AddSubMesh()
For K = 1 To Vertices
AddMeshVertex(*PointerVertex\X, *PointerVertex\Y, *PointerVertex\Z)
If *PointerColor <> #Null
MeshVertexColor(*PointerColor\RGB)
*PointerColor + SizeOf(MeshColor)
EndIf
If *PointerNormal <> #Null
MeshVertexNormal(*PointerNormal\X, *PointerNormal\Y, *PointerNormal\Z)
*PointerNormal + SizeOf(MeshNormal)
EndIf
If *PointerUV <> #Null
MeshVertexTextureCoordinate(*PointerUV\U, *PointerUV\V)
*PointerUV + SizeOf(MeshUV)
EndIf
*PointerVertex + SizeOf(MeshVertex)
Next K
For K = 1 To Faces
AddMeshFace(*PointerFace\V1, *PointerFace\V2, *PointerFace\V3)
*PointerFace + SizeOf(MeshFace)
Next K
FinishMesh()
EndIf
ProcedureReturn Result
EndProcedure
Check(InitEngine3D(), "InitEngine3D failed.")
Check(InitSprite(), "InitSprite failed.")
Check(InitKeyboard(), "InitKeyboard failed.")
OpenWindow(0, 0, 0, 800, 600, "", #PB_Window_SystemMenu)
Check(OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1, 0, 0), "OpenWindowedScreen failed.")
WorldShadows(#PB_Shadow_Modulative)
CreateTexture(0, 64, 64)
StartDrawing(TextureOutput(0))
Box(0, 0, 32, 32, RGB(0, 0, 255))
Box(32, 0, 32, 32, RGB(0, 255, 0))
Box(32, 32, 32, 32, RGB(255, 0, 0))
Box(0, 32, 32, 32, RGB(255, 255, 0))
StopDrawing()
CreateMaterial(0, TextureID(0))
CreateMeshEx(0, ?DataVertices, #Null, ?DataNormal, ?DataUV, ?DataFaces, 4, 2)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
CreateLight(0, RGB(255, 255, 255), 100.0, 0, 0)
LightSpecularColor(0, RGB(255, 0, 0))
Check(CreateCamera(0, 0, 0, 100, 100), "CreateCamera failed")
CameraLocate(0, 5, 5, -10)
CameraLookAt(0, 0, 0, 0)
Define Timer = ElapsedMilliseconds()
Define Mode = 0
Repeat
ClearScreen(0)
RenderWorld()
FlipBuffers()
If ElapsedMilliseconds() - Timer > 1000
If Mode = 0
CreateMeshEx(0, ?DataVertices2, #Null, ?DataNormal, ?DataUV2, ?DataFaces, 3, 1)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
Mode = 1
Else
CreateMeshEx(0, ?DataVertices, #Null, ?DataNormal, ?DataUV, ?DataFaces, 4, 2)
Check(CreateEntity(0, MeshID(0), MaterialID(0)), "CreateEntity failed")
Mode = 0
EndIf
Timer = ElapsedMilliseconds()
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent() = #PB_Event_CloseWindow
End
DataSection
DataVertices:
Data.f -0.5, 0.5, 0.0
Data.f 0.5, 0.5, 0.0
Data.f 0.5, -0.5, 0.0
Data.f -0.5, -0.5, 0.0
DataVertices2:
Data.f -0.75, 0.75, 0.0
Data.f 0.75, 0.75, 0.0
Data.f 0.75, -0.75, 0.0
Data.f -0.75, -0.75, 0.0
DataNormal:
Data.f 0.0, 0.0, 1.0
Data.f 0.0, 0.0, 1.0
Data.f 0.0, 0.0, 1.0
Data.f 0.0, 0.0, 1.0
DataUV:
Data.f 0.0, 0.0
Data.f 1.0, 0.0
Data.f 1.0, 1.0
Data.f 0.0, 1.0
DataUV2:
Data.f 1.0, 1.0
Data.f 0.0, 1.0
Data.f 0.0, 0.0
Data.f 1.0, 0.0
DataFaces:
Data.i 0, 1, 2
Data.i 0, 2, 3
EndDataSection