Jump to content

Render Transparent


daHappy

Recommended Posts

Hey i have som trouble to get this code work right... it doesent render transparent and i realy not know why

 

Every tipp is welcome ;)

 

So heres the code ;)

 

@ForgeSubscribe
public void onRender(RenderWorldLastEvent event) {	
Chunk hilfs = mc.theWorld.getChunkFromBlockCoords((int)mc.thePlayer.posX, (int)mc.thePlayer.posZ);
    	ChunkCoordIntPair hilfs1 = hilfs.getChunkCoordIntPair();
    	AxisAlignedBB box = AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double)hilfs1.getCenterXPos()-6, (double)0, (double)hilfs1.getCenterZPosition()-6, (double)hilfs1.getCenterXPos()+6, (double)256, (double)hilfs1.getCenterZPosition()+6);
         
         
         
        GL11.glPushMatrix();
         
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
         
        GL11.glTranslatef((float)-mc.thePlayer.posX,(float)-mc.thePlayer.posY, (float)mc.thePlayer.posZ);
        GL11.glColor4d(0, 200, 0, 128);
         

	//Bottom
	/**var2.addVertex(box.minX, box.minY, box.maxZ);
         var2.addVertex(box.minX, box.minY, box.minZ);
         var2.addVertex(box.maxX, box.minY, box.minZ);
         var2.addVertex(box.maxX, box.minY, box.maxZ);
         **/
         //Top
         GL11.glBegin(GL11.GL_QUADS);
         GL11.glVertex3d(box.maxX, box.maxY, box.maxZ);
         GL11.glVertex3d(box.maxX, box.maxY, box.minZ);
         GL11.glVertex3d(box.minX, box.maxY, box.minZ);
         GL11.glVertex3d(box.minX, box.maxY, box.maxZ);
         GL11.glEnd();
         
         //Side-East
         GL11.glBegin(GL11.GL_QUADS);
         GL11.glVertex3d(box.minX, box.maxY, box.minZ);
         GL11.glVertex3d(box.maxX, box.maxY, box.minZ);
         GL11.glVertex3d(box.maxX, box.minY, box.minZ);
         GL11.glVertex3d(box.minX, box.minY, box.minZ);
         GL11.glEnd();
         
         //Side-West
         GL11.glBegin(GL11.GL_QUADS);
         GL11.glVertex3d(box.minX, box.maxY, box.maxZ);
         GL11.glVertex3d(box.minX, box.minY, box.maxZ);
         GL11.glVertex3d(box.maxX, box.minY, box.maxZ);
         GL11.glVertex3d(box.maxX, box.maxY, box.maxZ);
         GL11.glEnd();
         
         //Side-Norh
         GL11.glBegin(GL11.GL_QUADS);
         GL11.glVertex3d(box.minX, box.maxY, box.maxZ);
         GL11.glVertex3d(box.minX, box.maxY, box.minZ);
         GL11.glVertex3d(box.minX, box.minY, box.minZ);
         GL11.glVertex3d(box.minX, box.minY, box.maxZ);
         GL11.glEnd();
         
         //Side-South
         GL11.glBegin(GL11.GL_QUADS);
         GL11.glVertex3d(box.maxX, box.minY, box.maxZ);
         GL11.glVertex3d(box.maxX, box.minY, box.minZ);
         GL11.glVertex3d(box.maxX, box.maxY, box.minZ);
         
         GL11.glVertex3d(box.maxX, box.maxY, box.maxZ);
         GL11.glEnd();
         
         GL11.glDisable(GL11.GL_BLEND);
         GL11.glEnable(GL11.GL_TEXTURE_2D);
         GL11.glPopMatrix();
}

 

Link to comment
Share on other sites

Not sure but I think that you'll get a step further maybe if you do this:

Put this line:

GL11.glEnable(GL11.GL_BLEND);

Above this line:

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

Not sure but I think it may work, at least worth trying :)

 

After that you can try replacing:

GL11.GL_ONE_MINUS_SRC_ALPHA

With

GL11.GL_ONE

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.