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 guys,

 

I am trying to make surface on top of a tileentity. The code looks like this:

 

     Tessellator te = Tessellator.instance;
                GL11.glEnable(GL11.GL_BLEND);        
                te.startDrawingQuads();
                float xOff = -0.5F, yOff = -1.499F, zOff = -0.5F;
                te.setColorRGBA_F(1, 1, 1, 0.5f); 
                te.addVertexWithUV(xOff, yOff+1, zOff, 0.3, 0.1);
                te.addVertexWithUV(xOff, yOff+1, zOff+1, 0.7, 0.1);
                te.addVertexWithUV(xOff+1, yOff+1, zOff+1, 0.3, 0.1);
                te.addVertexWithUV(xOff+1, yOff+1, zOff, 0.3, 0.1);
                te.draw();//method 2
                GL11.glDisable(GL11.GL_BLEND);

 

and it's transparent ingame but the problem is that you can see through the tileentity:

 

yhtQ7RO.png

 

 

Thanks in advance

enbecko

Well, you have two problems.

 

0) The tessellator doesn't give a shit about transparency, that's a GL thing.

1) You never tell it what blend function to use

2) Your UVs are fucked up.

 

                te.addVertexWithUV(xOff, yOff+1, zOff, 0.3, 0.1);
                te.addVertexWithUV(xOff, yOff+1, zOff+1, 0.7, 0.1);
                te.addVertexWithUV(xOff+1, yOff+1, zOff+1, 0.3, 0.1);
                te.addVertexWithUV(xOff+1, yOff+1, zOff, 0.3, 0.1);

 

Let me distill this down into the important information.  Removing Y entirely.  Making xOff and zOff equal to zero.  Multiplying the UVs by ten to reduce textual chaos.

 

(0, 0) : (3, 1)

(0, 1) : (7, 1)

(1, 1) : (3, 1) //again

(1, 0) : (3, 1) //and a third time

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Hi

 

>and it's transparent ingame but the problem is that you can see through the tileentity:

I don't understand what you mean - if you can't see through the tileentity, it wouldn't be transparent-?

 

What is it supposed to look like?  I'd also suggest you test just one TileEntity at a time, it looks like you've got 50 of them in your screenshot?

 

In addition to Draco's comments, some info about the tessellator, in case you're not familiar:

http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html

 

-TGG

  • Author

Hey,

 

thanks for the help but i use these UVs only for tests but still I don't understand why Tileentitys rendered with the TileEntitySpecialRenderer get invisible behind the surface:

 

pNTVJ91.png

 

                GL11.glEnable(GL11.GL_BLEND);    
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

                GL11.glColor4f(1, 1, 1, .5F);
                te.startDrawingQuads();
                float xOff = -0.5F, yOff = -1.4F, zOff = -0.5F;
                te.addVertexWithUV(xOff, yOff+1, zOff+1, 0.3, .1);
                te.addVertexWithUV(xOff, yOff+1, zOff+2, 0.3, .1);
                te.addVertexWithUV(xOff+1, yOff+1, zOff+2, 0.3, .1);
                te.addVertexWithUV(xOff+1, yOff+1, zOff+1, 0.3, .1);
                te.draw();
                GL11.glDisable(GL11.GL_BLEND);

 

enbecko

Is your block declared as being opaque? Are you rendering in pass 0?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Hey,

 

thanks for the help but i use these UVs only for tests but still I don't understand why Tileentitys rendered with the TileEntitySpecialRenderer get invisible behind the surface:

 

Hi

 

unfortunately I still don't understand what you're trying to do and what the symptoms of the problem are.  The picture looks strange, but I don't know what you expect it to look like.

 

-TGG

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.