Firstly hi panda’s!
I’m having some trouble in my program, I’m attempting to procedurally create a map full of cubes but it is seemingly randomly crashing while I’m in one of my loops. I’m pretty sure it’s in this loops that the crash occurs because when I leave it out the other part of the code which creates the top of the cube surfaces works, but this loop which creates the sides of the cubes fails.
I added a print function which prints the amount of vertices in the GeomVertexData, but every time it crashes this value is different therefore the random part of the crash, and I recieve no error when running it, panda just closes.
here is some of the code, the for loop where the crash I reckon is happening in.
Orientation = [[[-0.5, -0.5], [0.5, -0.5]], [[-0.5, 0.5], [-0.5, -0.5]], [[0.5, 0.5], [-0.5, 0.5]], [[0.5, -0.5], [0.5, 0.5]]]
i = -1
for Cube in CubeList:
i = i + 1
#The variable Cube is simply the height of a cube, cubelist is a list of the 4 neighbouring cubes heights
if Cube <= Height:
#Only make it's side go downwards and not up
Diff = Height - Cube
for step in range(0, Diff):
#Add the vertices with their colour
Vertex.addData3f(x + Orientation[i][0][0], Height - step, z + Orientation[i][0][1]); Colour.addData4f(1, 0, 0, 1)
Colour.addData4f(0, 1, 1, 1)
Vertex.addData3f(x + Orientation[i][1][0], Height - step, z + Orientation[i][1][1])
Colour.addData4f(0, 1, 1, 1)
Vertex.addData3f(x + Orientation[i][1][0], Height - step - 1, z + Orientation[i][1][1])
Colour.addData4f(0, 1, 1, 1)
Vertex.addData3f(x + Orientation[i][0][0], Height - step - 1, z + Orientation[i][0][1])
Colour.addData4f(0, 1, 1, 1)
VLenght = int(VertexData.getNumRows())
print(VLenght)
Triangles.addVertices(VLenght - 2, VLenght - 3, VLenght - 4)
Triangles.closePrimitive()
Triangles.addVertices(VLenght - 1, VLenght - 2, VLenght - 4)
Triangles.closePrimitive()
I’m new to panda3d, moved over from Python-Ogre due to Panda’s better documentation. So If I’m doing something horribly wrong performance or general not recommended things wise, please say. The code is a port from the python code I used in Ogre3D with minimal changes, it worked in ogre the.
It crashes around 57596, 60670, 35582 vertices printed by print(VertexData.getNumRows())
The loop is entered 30, 30, 18, 26 times, just as random as the previous tests.
I think I added all the information I could gather now, if more info is needed please ask!
So is there a way to make Panda more verbose and give me more errors, warnings etc. and is there any limitation panda can handle when creating procedural objects?
As always, thanks for any help in advance.