Skip to content

creating an empty/hollow Rectangle #425

Closed Answered by coderedart
MrAliSalehi asked this question in Q&A
Discussion options

You must be logged in to vote

There will be many ways to do this depending on what you want.

are you going to draw anything behind the rectangle? If not, then just draw a rectangle. set a clip rect to be just a little bit smaller than the previous rectangle. clear color.

If you want a 3D rect transformed by camera, keep a "scratch" texture aside. do the same rect -> clip rect -> clear thing in that texture, and then render that texture into the main framebuffer like a normal two triangled mesh. This will make sure that anything drawn behind the rect will also survive.

If the rectangle is 2D, then its probably better to use a gui paint library. egui provides you a painter that can draw a rect (idk if its hollow inside …

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@MrAliSalehi
Comment options

Answer selected by MrAliSalehi
Comment options

You must be logged in to vote
11 replies
@coderedart
Comment options

@MrAliSalehi
Comment options

@coderedart
Comment options

@MrAliSalehi
Comment options

@asny
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants