Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

Screenshot_116.png

Edited by RobinCirex

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.

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

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

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

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.