A downloadable asset pack

Download NowName your own price


Download NowName your own price

Click download now to get access to the following files:

draw_clip.gmz 16 kB


Log in with itch.io to leave a comment.

Great example code.

When I imported into GMS2 and pressed play, the console was filled with this message:

Draw failed due to invalid input layout

The first example doesn’t clip as expected; it draws the outline for a rectangle and an outline for the circle but that’s it.

The problem occurs in obj_clip_rect_shd’s draw event, on line: draw_circle(mouse_x, mouse_y, mouse_r, false);

I expected it was an issue with the shader; when I comment out that draw_circle line, I don’t see the error anymore.

In rm_clip_rect_shd, I noticed a “Compatibility_Colour” layer is created with a depth of 2147483600, which I think is out of range in GameMaker Studio 2 so I set it to 999. This alone did not fix the problem.

I deleted the Compatibility_Instances_Depth_0 layer, create a new instance layer, and dragged obj_clip_rect_shd into it. Still did not remove the console message.

Finally, I edited shd_clip_rect and discovered that commenting out the line:

v_vTexcoord = in_TextureCoord;

resulted in no warning messages in the console and the shader worked.

I was just thinking how this could be used for blooming windows

What do you imagine this could be used for? :)


As the post mentions, it is most commonly used for UI elements, such as scrollable areas or minimaps.

There are numerous creative possibilities, however - e.g. "ibb & obb" uses clip regions heavily to achieve it's distinct art direction with parallax layers peeking through each other.