[DSG] Attention Code Monkeys

Posted by DSG on Feb. 6, 2011, 2:33 a.m.

so, map design was a problem for a while, but I'm almost finished with 3 worlds

rooms are way more 3D so I thought, shit. I should just use textures.

So, i tried this

draw_primitive_begin_texture(pr_trianglestrip,sprite_get_texture(SPtexture,0))
draw_vertex_texture(x+60,y,1,0)
draw_vertex_texture(x+70,y+50,1,1)
draw_vertex_texture(x,y+40,0,0)
draw_primitive_end()

rtfm? i did. It just shows up black.

So uhm. Yea, all I have to share right now.

I've been making slow rocky progress with the implementation of 3D effects, don't know why I didn't try primitives earlier.

Ive done it before too. idfkwuwts.

this appears closer, but sgtill not working. if you run this in game maker, and make the texture sprite a 32x32 box with a target shape in the middle or a large X in the middle so you can tell why this looks wrong

draw_primitive_begin_texture(pr_trianglestrip,sprite_get_texture(SPtexture,0))
draw_set_color(c_white)
draw_vertex_texture(x,y,0,0)
draw_vertex_texture(x,y+20,0,1)
draw_vertex_texture(x+30,y+30,1,1)
draw_vertex_texture(x+30,y-10,1,0)
draw_vertex_texture(x,y,0,0)
draw_primitive_end()

Comments

Requiem 13 years, 9 months ago

I'm assuming you want something like this?

(Edit: Switched to a trianglestrip. I'd normally recommend a trianglelist, but less overhead with a strip.)

draw_primitive_begin_texture(pr_trianglestrip,sprite_get_texture(SPtexture,0));
draw_set_color(c_white);

draw_vertex_texture(x,y+200,0,1);
draw_vertex_texture(x,y,0,0);
draw_vertex_texture(x+200,y+150,1,1);
draw_vertex_texture(x+200,y+50,1,0);

draw_primitive_end();

Astryl 13 years, 9 months ago

Use this:

draw_primitive_begin_texture(pr_trianglestrip,sprite_get_texture(SPtexture,0))
draw_vertex_texture_color(x,y,0,0,c_white,1)
draw_vertex_texture_color(x+30,y-10,0,1,c_white,1)
draw_vertex_texture_color(x,y+20,1,1,c_white,1)
draw_vertex_texture_color(x+30,y+30,1,0,c_white,1)
draw_primitive_end()

RTFMA. In 3D, when you are using textures + color-materials, you need to specifiy the texture blend.

c_white displays the texture at it's usual color value.

Also, Triangle Strips, when used to draw Quads, must (Or should) be drawn in a Z pattern.

Read this: http://en.wikipedia.org/wiki/Triangle_strip