MEMORY ACCESS ERROR
Blitz3D Forums/Blitz3D Programming/MEMORY ACCESS ERROR
| ||
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? |
| ||
sorry, 127x127 tiles are 15876 tiles and 31752 triangles :-) now, what can i do??? |
| ||
Maybe you can post some code? I don't really understand what you're getting at with the tiles/triangles thing... |
| ||
sounds like an out of memory error, but as gfk says prob need some code |
| ||
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. |
| ||
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 |
| ||
That's too many vertices. When x,y go to 127 you have 128*128*4 = 64K vertices. |
| ||
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? |