Jump to content

[1.15.2] Render 2D Rect in 3D


RobinCirex

Recommended Posts

7 minutes ago, ChampionAsh5357 said:

Probably a vertex buffer in the translucent render type that draws the background with the text that's centered and rendered using FontRenderer. Basic, some version of EntityRenderer#renderName with more flare.

well, I wanna render rects though, textured rects too. This was just an example fo what I mean by "2D Rect in 3D"

Link to comment
Share on other sites

2 minutes ago, RobinCirex said:

well, I wanna render rects though, textured rects too.

Yes, that's why I mentioned the vertex buffer as that can draw textured rects provided it uses the same render type. The method mentioned has useful tidbits of code that provides how to face the orientation towards the player at all times.

Edited by ChampionAsh5357
Link to comment
Share on other sites

11 hours ago, ChampionAsh5357 said:

Yes, that's why I mentioned the vertex buffer as that can draw textured rects provided it uses the same render type. The method mentioned has useful tidbits of code that provides how to face the orientation towards the player at all times.

Okay, could you maybe explain how I would do that?

Link to comment
Share on other sites

Well it depends on where you are trying to draw it from. You'll need an instance of a MatrixStack to get the current Matrix4f for placement in the world along with the x, y, z coordinates of where you want it to render. The IRenderTypeBuffer used to get the vertex builder can either be gotten from a local variable or the static instance within the Minecraft class. As for which vertex buffer, you would probably need a RenderType that supports quad draw mode (7 for OpenGL) that supports position, texture, and color vertices. From there, it's a matter of placing the vertices where you want on the screen and binding the correct texture/atlas.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.