Posted October 14, 20204 yr Hey, I'm trying to render 2D rects in 3D for my mod. Does somebody have an idea how to make that? I attached an example Edited October 14, 20204 yr by RobinCirex
October 14, 20204 yr 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.
October 14, 20204 yr Author 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"
October 14, 20204 yr 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 October 14, 20204 yr by ChampionAsh5357
October 15, 20204 yr Author 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?
October 15, 20204 yr 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.
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.