• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

3D SOLVED achieving depth with multiple d3d-primitives in one draw event

Solved: I had some random drawing code in another object. Sorry for the mistake :V
Lesson is: when implementing d3d, start by removing all drawing calls then introduce them in an organized fashion.

EDIT: I"m having trouble recreating this problem in the FPS tutorial, soo i'll try and figure out what's going on here. (maybe it's because I'm using event_perform(ev_draw,0) in a control object's draw event.
Hello GM Wizards,
Using d3d in gm8 I cannot figure out how to draw multiple primitives in one draw event with 3d-rendering orders. I apologize for the syntax -_-
I've got this d3d stuff in the creation event:
Code:
 d3d_start();
 d3d_set_hidden(false);
 d3d_set_lighting(false);
 d3d_set_culling(false);
 texture_set_interpolation(true);
and I have an object with a draw event that draws multiple shapes (hundreds) in 3d using d3d primitives:
Code:
repeat(shapenum)

{ d3d_transform_set_identity();
d3d_transform_add_rotation_axis(global.camcos,global.camsin,0,rot[check,0]);
d3d_transform_add_translation(xx[check,0],yy[check,0],zz[check,0]);
d3d_primitive_begin_texture(pr_trianglestrip,tex);
d3d_vertex_texture_color(-(25/2)*xscale[check,0]*global.camsin,(25/2)*xscale[check,0]*global.camcos,-(25/2)*yscale[check,0],0, 0,global.c[col[check]],1);
d3d_vertex_texture_color(-(25/2)*xscale[check,0]*global.camsin,(25/2)*xscale[check,0]*global.camcos,(25/2)*yscale[check,0],0, 1,global.c[col[check]],1);
d3d_vertex_texture_color((25/2)*xscale[check,0]*global.camsin,-(25/2)*xscale[check,0]*global.camcos,-(25/2)*yscale[check,0],1, 0,global.c[col[check]],1);
d3d_vertex_texture_color((25/2)*xscale[check,0]*global.camsin,-(25/2)*xscale[check,0]*global.camcos,(25/2)*yscale[check,0],1, 1,global.c[col[check]],1);
d3d_primitive_end();
d3d_transform_set_identity() ;
check = check + 1}
The game also has a 3d floor, so these shapes need to be able to "clip" into the floor at their positions.
I can force drawing order using ds_priority_lists, but still no floor clipping, the floor is always behind the shapes.

I've tried using d3d_set_depth, but it doesn't do anything for me. I think it doesn't work in the draw event.
I had hoped d3d would take care of this stuff "behind the scenes".

(I have spent today updating my game's system from my own 3d-technique that drew chunks of ground between shapes, but due to low FPS I wanted to try game makers 3d system, as drawing the floor "my way" was costly)

If you need more context, here's a private dev video I made to show the editor tools, but you can get the idea of what i'm trying to achieve with d3d. THIS VIDEO IS BEFORE IMPLEMENTING D3D (trying to replicated with d3d)

Happy Holidays,
Jared
 
Last edited:
Top