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 thisdraw_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()
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()
Hmm. Works just fine for me… I'd check to make sure that the sprite_get_texture is actually returning a positive id. Running your game in Debug Mode and then putting sprite_get_texture(SPtexture,0) in one of the debug lines will do the trick. This may also be caused by your draw mode, so try setting it back to normal prior to drawing. Who knows?
Actually, you're right. It's drawing the texture as pure black. (Originally I just drew black squiggles.)
At least with 3d primitives, you only need to specify the texture at the beginning, so maybe you should just replace draw_vertex_texture with draw_vertex?
Well, basically i'm trying to fake a 3D wall, i want to draw a square sprite with perspective. (the 4 corners of each image/wall will have to be capable of moving with the view like looking inside a 3D box. a wall to the left, right, top, and bottom and look 3D with perspective.)
@DFortun81: Not exactly creating the effect. It'll make triangles but i want a SQUARE. and I assume i have to figure out how to make it out of triangles? because the triangles don't seem to work correctly. the texture bends in a parallelogram manor, not how it should like perspective.
@Cesque: Nope, just comes out black. I think it has to be draw_vertex_textureBasically, when you want to draw something in the proper color, do draw_set_color(c_white) first.
Second of all, draw_vertex_texture is crucial for textured primitives.Third of all, you cannot fake 3D textures by using 2D primitives. You can approximate the appearance, but not create a correctly 3D looking wall.Fourth of all, the last piece of code has one redundant line, namely the last one. Either you don't know how pr_trianglestrip works or it was just something you overlooked.Last but not last least, you should call sprite_get_texture only once, like in create event. It would speed up your program with a tiny bit.I think use DF81's _color() advice with c_white and 1 alpha,
and sirXemic's advice about the create event but im pretty sure that the triangle strip use is correct…But will help you with many programming dilimea's is to go step by step. I would do a show_message() of the sprite_get_texture() just to be sure, unless DF81's advice works right away.