surface_get_texture


语法:

surface_get_texture(surface_id);

参数 描述
surface_id 即将获取纹理的表面层ID。


返回:

指针


描述

这个函数返回表面层纹理的特殊 指针 。This value can then be used in other draw functions, particularly in general 3D and some of the 2D primitive functions.

注:由于储存在显存里,表面层运行时存在随时停止并退出的可能性。在直接引用它们之前,你需要 一直使用 surface_exists检测表面层是否退出。更多信息请查阅 表面层


例如:

var tex;
tex = surface_get_texture(surf);
draw_primitive_begin_texture(pr_trianglestrip, tex);
draw_vertex_texture(0, 480, 0, 0);
draw_vertex_texture(640, 480, 1, 0);
draw_vertex_texture(640, 480, 1, 1);
draw_vertex_texture(0, 480, 0, 1);
draw_primitive_end();

The above code will draw a 4 vertex triangle strip textured with the texture held in the "tex" variable, which is itself taken from a previously created surface.