• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Vertex buffer(Solved)

D

Dreambig

Guest
Whenever I run this code

d=sprite_get_texture(sprite3,1)
draw_set_color(c_white)
for(Timesrun=0;Timesrun<121;Timesrun+=1)
{draw_primitive_begin_texture(pr_trianglefan,d)
draw_vertex_texture(PointI[S,p],LineI[S,p],imx[S,p],imy[S,p])
p+=1
draw_vertex_texture(PointI[S,p],LineI[S,p],imx[S,p],imy[S,p])
p+=1
draw_vertex_texture(PointI[S,p],LineI[S,p],imx[S,p],imy[S,p])
p+=1
draw_vertex_texture(PointI[S,p],LineI[S,p],imx[S,p],imy[S,p])
draw_primitive_end()
S+=1 p=1 if S=121{S=1 p=1 Timesrun=0 }
}

I get

___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object object3:

Fatal Error: Can not create vertex buffer of size 98304 bytes
20965 vertex buffers allocated with total size of 2012960 KB
at gml_Object_object3_DrawEvent_1 (line 12) - draw_primitive_end()
############################################################################################

Whenever I change the 121 in S=121 to 122, it shows the picture, but it won't change the picture even if I change the values. I checked, and the values were able to be changed, just that the picture wasn't changing.


How do I fix this?
 
You're resetting the variable that you use to control the length of the loop, from inside of the loop! And as a result it looks like the loop continues until you run out of memory.

Out of curiosity, how long does that loop run before you see the error message? Seconds? Fractions of a second? Minutes?
 
D

Dreambig

Guest
Thanks, I put that part of the code out of the loop and it works. I let it run for 9 minutes and nothing bad happened after I changed the code, before it didn't even make it to the room.
 
Top