Jump to content

[1.7.10] Tesselator opacity


enbecko

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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.

Announcements



×
×
  • Create New...

Important Information

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