kamiyasi
Member
Hi, everyone. I've got randomly generated planets in my 3D game. To give them unique textures, I am using surfaces. However, the method I am using does not seem to be working; the model does not draw at all when I use the texture referenced from a background made from a surface. I am guessing it is because creating a new background during runtime does not include the option to check the texture as 'use for 3D' but I am not sure the actual reason.
Code:
var surfbg;
/////create the draw surface
if !surface_exists(psurf)
{
psurf = surface_create(512, 512);
surface_set_target(psurf);
draw_clear_alpha(c_black, 0);
surface_reset_target();
}
////draw to surface
surface_set_target(psurf);
draw_clear_alpha(c_black, 0);
draw_background_ext(bck_craters,0,0,1,1,0,c_white,1);
/////make texture from surface
surfbg = background_create_from_surface(psurf,0,0,512,512,0,0);
tex = background_get_texture(surfbg);
//tex = background_get_texture(tex_spacewall);
//background_delete(surfbg);
////done with surface
surface_reset_target();
////clear surface
surface_free(psurf);
//////done
maketex = 1;