• 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!

GameMaker SOLVED: draw text shadow z-fighting in 3D

Hello,

I'm working on a 2D platformer but I decided for parts of the menu to be 3D. It used to be everything 2D but now I want to show a simple 3D Model in the background and also use the perspective view to get a nice parallax effect.
The Problem is: up until now, I used the following script to draw text shadow
Code:
//draw text shadow
draw_set_color(argument10);
draw_set_alpha(argument11);
draw_text_ext_transformed(xx+lengthdir_x(sh_len, sh_dir),
                    yy+lengthdir_y(sh_len, sh_dir), string_hash_to_newline(str),
                    sep, w, xscale, yscale, angle
                    );

//draw text
draw_set_color(prev_col);
draw_set_alpha(prev_alpha);
draw_text_ext_transformed(xx, yy, string_hash_to_newline(str), sep, w,
                    xscale, yscale, angle
                    );
Now this code introduces z-fighting. And I can't wrap my head around how to draw text from the same object to another depth/layer in the new layer system.
Do I have to draw the text to a surface then change it to a texture and then draw the texture to a primitive and then draw the primitive at the right z location?
What would be the best approach? How does one tackle this problem?

Thanks in advance for your advice!
 
L

Lonewolff

Guest
Good question. I am pretty sure gpu_zwriteenable turns on the z buffer and gpu_set_ztestenable performs the actual z testing.

And yes, I am confident that it will break the batch as it is a state change on the GPU. The overhead would be minimal though.
 
Top