S
SilentX
Guest
The following code is supposed to draw a tiled floor, leaving out spaces for holes. However, it's not appearing.
I have created a shader, and left the code as what was automatically created.
I'm not sure if I have to draw this anywhere else in code, or whether vertex_submit takes care of that.
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_color();
vertex_format_add_texcoord();
global.my_format = vertex_format_end();
v_buff1 = vertex_create_buffer()
for(i = 0; i < 30; i++)
{
for(j = 0; j < 30; j++)
{
if(!instance_position(i*32,j*32,obj_hole))
{
if(i < 25 && j < 24)
{
vertex_begin(v_buff1,global.my_format);
vertex_position_3d(v_buff1,i*32,j*32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,0,0);
vertex_position_3d(v_buff1,(i*32)+32,j*32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,1,0);
vertex_position_3d(v_buff1,(i*32)+32,(j*32)+32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,1,1);
vertex_position_3d(v_buff1,i*32,(j*32)+32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,0,1);
vertex_end(v_buff1);
var tex = sprite_get_texture(spr_floor1,0);
shader_set(shader_0);
vertex_submit(v_buff1,pr_trianglefan,tex);
shader_reset();
}
}
}
}
I have created a shader, and left the code as what was automatically created.
I'm not sure if I have to draw this anywhere else in code, or whether vertex_submit takes care of that.
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_color();
vertex_format_add_texcoord();
global.my_format = vertex_format_end();
v_buff1 = vertex_create_buffer()
for(i = 0; i < 30; i++)
{
for(j = 0; j < 30; j++)
{
if(!instance_position(i*32,j*32,obj_hole))
{
if(i < 25 && j < 24)
{
vertex_begin(v_buff1,global.my_format);
vertex_position_3d(v_buff1,i*32,j*32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,0,0);
vertex_position_3d(v_buff1,(i*32)+32,j*32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,1,0);
vertex_position_3d(v_buff1,(i*32)+32,(j*32)+32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,1,1);
vertex_position_3d(v_buff1,i*32,(j*32)+32,0);
vertex_color(v_buff1,c_white,1);
vertex_texcoord(v_buff1,0,1);
vertex_end(v_buff1);
var tex = sprite_get_texture(spr_floor1,0);
shader_set(shader_0);
vertex_submit(v_buff1,pr_trianglefan,tex);
shader_reset();
}
}
}
}