MEMORY ACCESS ERROR

Blitz3D Forums/Blitz3D Programming/MEMORY ACCESS ERROR

JPD(Posted 2003) [#1]
I had made a mesh-object. I should be a simple terrain like used in MonsterTruckMadness. I have decided to take 256x256 tiles. For each tile a other grafik. When i use 126x126 tiles, that are 15876 triangles, it works. When i use 127x127 i get the error "MEMORY ACCESS ERROR" at "Render World" ... What can i do?


JPD(Posted 2003) [#2]
sorry, 127x127 tiles are 15876 tiles and 31752 triangles :-)

now, what can i do???


GfK(Posted 2003) [#3]
Maybe you can post some code? I don't really understand what you're getting at with the tiles/triangles thing...


Ross C(Posted 2003) [#4]
sounds like an out of memory error, but as gfk says prob need some code


Gabriel(Posted 2003) [#5]
You've got too many triangles in a single surface. I hit upon this problem with my single surface entity system a few months ago. I'm not sure of the exact figure, but I found it to be over 40,000 triangle per surface, so I think your maths might still be out. But yeah, I'm pretty sure that a Memory Access Violation on RenderWorld is because you have more triangles in a surface than DirectX can support.

The solution? 2 Surfaces, I suppose. Or 4. Whatever's easiest.


JPD(Posted 2003) [#6]
OK, my code is simply! I read in a map with different Y-Values. Then I put them together to a mesh, like this:


;-------------------------------------
;Dateieinlesen
mapstream=ReadFile("map1.dat")
;Heightmap einlesen
Dim Map(255,255)
For PYR = 255 To 0 Step -1
For PXR = 0 To 255
Map(PXR,PYR) = ReadByte(mapstream)
Next
Next
;------------------------------------


;Meshcreation
For y = 0 To 120 ;maximal 126!!!
For x = 0 To 120 ;maximal 126!!!
Y1 = map(x,y)
Y2 = map(x,y+1)
Y3 = map(x+1,y+1)
Y4 = map(x+1,y)
UNLI = AddVertex( surf,x, Y1,y , 0,1)
OBLI = AddVertex( surf,x, Y2,y+1 , 0,0)
OBRE = AddVertex( surf,x+1, Y3,y+1 , 1,0)
UNRE = AddVertex( surf,x+1, Y4, y , 1,1)
AddTriangle surf, UNLI, OBLI, OBRE
AddTriangle surf, UNLI, OBRE, UNRE
Next
Next
UpdateNormals mesh


Floyd(Posted 2003) [#7]
That's too many vertices.

When x,y go to 127 you have 128*128*4 = 64K vertices.


JPD(Posted 2003) [#8]
I know it... When i want to use a terrain with 256x256 tiles, i have to create 4x 128x128 meshes and put them together - or?