Blitz Bug?

Blitz3D Forums/Blitz3D Programming/Blitz Bug?

MilkyBarKid(Posted 2003) [#1]
The Createmesh example (under createmesh) does not seem to work, accord to trisrendered it renders 8 triangles, but i can't see any of them, i'm using blitz IDE V1.80 runtime version V1.80.

Dunno why i can;t see the ramp.


Rimmsy(Posted 2003) [#2]
are you using a 'flipmesh' or 'updatenormals'?

matt


Floyd(Posted 2003) [#3]
WireFrame is unreliable on some graphics cards.

That's the only possible problem I can see.


cyberseth(Posted 2003) [#4]
I have no problems here, so I'd have to agree with Floyd.


MilkyBarKid(Posted 2003) [#5]
Here is the code, but i will try the update normals:

AppTitle "PC Battles 3D"

Graphics3D 640,480,16,0
SetBuffer(BackBuffer())

;values needed for debug info
Global Frame_Rate,Frame,My_Clock = MilliSecs()


Camera = CreateCamera()
Light = CreateLight(1,Camera)
CameraRange Camera,1,1000

PositionEntity Camera,-5,10,-5
RotateEntity Camera,60,0,0

Global Grass = LoadTexture("Textures\grass.bmp",256)
;ScaleTexture Grass,3,3

Global Beach = LoadTexture("Textures\beach.bmp",256)
;ScaleTexture Beach,3,3

Global Sea = LoadTexture("Textures\Sea.bmp",256)
;ScaleTexture Sea,3,3

Global Road_Straight_Horizontal = LoadTexture("Textures\Horizontal_Straight.bmp",256)
Global Road_Straight_Vertical = LoadTexture("Textures\vert_straight.bmp",256)
Global Bottom_Left_Corner = LoadTexture("Textures\Bottom Left Corner.bmp",256)
Global Bottom_Right_Corner = LoadTexture("Textures\Bottom Right Corner.bmp",256)
Global Top_Left_Corner = LoadTexture("Textures\Top Left Corner.bmp",256)
Global Top_Right_Corner = LoadTexture("Textures\Top Right Corner.bmp",256)

Global Mesh = Render_Use_Mesh()

PositionEntity mesh,0,2,0


While Not KeyHit (1)
Cls
TurnEntity Mesh,0,1,0
update_camera(camera)
UpdateWorld()
RenderWorld()
Display_Debug_Info()
Flip
Wend

Function Display_Debug_Info()

Locate 40,390
Print "Triangles Rendered: " + TrisRendered()
Locate 40,410
Print "Frame Rate : " + Frame_Rate

Frame= Frame +1

If MilliSecs() >= My_clock +1000 Then
My_Clock = MilliSecs()
Frame_Rate = Frame
Frame = 0
End If

Locate 40,430
Print "Vid Mem: " + AvailVidMem()

Locate 40,450
Print "Vid Mem Total: " + TotalVidMem()

End Function
;---------------------------------------------------------------------------------
Function Load_Map(LevelNumber$)


End Function

Function Render_Use_Mesh()

Mesh = CreateMesh()

Surface = CreateSurface(mesh)

v0 = AddVertex(Surface,0,0,0)
v1 = AddVertex(Surface,0,0,1)
v2 = AddVertex(Surface,4,0,1)
v3 = AddVertex(Surface,4,0,0)
v4 = AddVertex(Surface,0,2,0)
v5 = AddVertex(Surface,0,2,1)

t0 = AddTriangle(Surface,v0,v3,v2)
t1 = AddTriangle(Surface,v0,v2,v1)
t2 = AddTriangle(Surface,v0,v4,v3)
t3 = AddTriangle(Surface,v1,v2,v5)
t4 = AddTriangle(Surface,v0,v1,v5)
t5 = AddTriangle(Surface,v0,v5,v4)
t6 = AddTriangle(Surface,v2,v4,v5)
t7 = AddTriangle(Surface,v2,v3,v4)

Return mesh

End Function
;---------------------------------------------------------------------------------
Function Update_Camera(Which_Camera)

If KeyDown(203) Then ;left
TurnEntity Which_Camera,0,1,0
End If

If KeyDown(205) Then ;right
TurnEntity Which_Camera,0,-1,0
End If

If KeyDown(200) Then ;up
TurnEntity Which_Camera,1,0,0
End If

If KeyDown(208) Then ;down
TurnEntity Which_Camera,-1,0,0
End If

If KeyDown(17) Then ;w
MoveEntity Which_Camera,0,0,.5
End If

If KeyDown(31) Then ; s
MoveEntity Which_camera,0,0,-.5
End If

End Function






Also, if wireframe doesn;t work, can i texture it with the normal textureentity,or do i have to use brushs (only just learning this stuff ook, so expect a few stupid questions )


[EDIT] Ok, got it working, looks like i needed to update the normals of the mesh before it would work, now the fun part, playing around with the code :)


MilkyBarKid(Posted 2003) [#6]
OK, new problem, the textures don;t seem to be applied properly, the mesh has the correct colours, but not the actaul image on it, is there another function that needs to be used to correctly apply the texture?

ONce this is done, my advanced wars clone can begin.