Jump to content

Recommended Posts

Posted

Hey, I seem to be having a problem with rendering my TESR. It only renders the outline if a mob is in my view. It use to work fine on 1.6.4 but since I've updated to 1.7.2, it has changed.

 

I've also correctly made sure I'm binding it correctly and that it renders past the standard limit.

 

In ClientProxy

ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBuildingBlock.class, new OutlineRenderer());

 

In TileEntity

@Override
public double getMaxRenderDistanceSquared()
{
return 16384D;
}

@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
return INFINITE_EXTENT_AABB;
}

 

width=800 height=449https://dl.dropboxusercontent.com/s/4fm4onyzlnkr3s6/2014-03-17_18.40.08.png[/img]

width=800 height=449https://dl.dropboxusercontent.com/s/zg38ka0fs36q461/2014-03-17_18.40.10.png[/img]

 

If you have any answers to why this might be happening, let me know!

Posted

This is the only other relevant code besides the one I posted above.

package com.mrcrayfish.construction.client.render;

import org.lwjgl.opengl.GL11;

import com.mrcrayfish.construction.tileentity.TileEntityBuildingBlock;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;

public class OutlineRenderer extends TileEntitySpecialRenderer
{
    @Override
    public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f)
    {
TileEntityBuildingBlock tebb = (TileEntityBuildingBlock) tileentity;
if (tebb.renderOn)
{
    int metadata = tebb.getWorldObj().getBlockMetadata(tebb.xCoord, tebb.yCoord, tebb.zCoord);

    int width = tebb.width - 2;
    int height = tebb.height - 2;
    int depth = tebb.depth - 2;

    int offsetX = 0;
    int offsetY = tebb.offsetY;
    int offsetZ = 0;

    int colour = tebb.lineColours[tebb.count];

    if (metadata == 2)
    {
	offsetX = -tebb.offsetZ - width - 1;
	offsetZ = tebb.offsetX;
	offsetX -= tebb.bOffsetZ;
	offsetZ += tebb.bOffsetX;
    }
    if (metadata == 5)
    {
	int temp = width;
	width = height;
	height = temp;
	offsetX = -tebb.offsetX - (width + 1);
	offsetZ = -tebb.offsetZ - (height + 1);
	offsetX -= tebb.bOffsetX;
	offsetZ -= tebb.bOffsetZ;
    }
    if (metadata == 3)
    {
	offsetX = tebb.offsetZ;
	offsetZ = -tebb.offsetX - (height + 1);
	offsetX += tebb.bOffsetZ;
	offsetZ -= tebb.bOffsetX;
    }
    if (metadata == 4)
    {
	int temp = width;
	width = height;
	height = temp;
	offsetX = tebb.offsetX;
	offsetZ = tebb.offsetZ;
	offsetX += tebb.bOffsetX;
	offsetZ += tebb.bOffsetZ;
    }

    offsetY += tebb.bOffsetY;

    if (tebb.hasDrawnBlueprint)
    {
	Tessellator tessellator = Tessellator.instance;
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_TEXTURE_2D);

	if (tebb.renderAll) GL11.glDisable(GL11.GL_DEPTH_TEST);

	GL11.glLineWidth(5F);
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 1.5D + height + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 0.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.addVertex(x + 0.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + 0.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 0.5D + offsetZ);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 1.5D + height + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 1.5D + height + offsetZ);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 1.5D + height + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + height + 1.5D + offsetZ);
	tessellator.draw();
	tessellator.startDrawing(3);
	tessellator.setColorOpaque_I(colour);
	tessellator.setBrightness(255);
	tessellator.addVertex(x + width + 0.5D + 1.0D + offsetX, y + 0.5D + offsetY, z + height + 0.5D + 1.0D + offsetZ);
	tessellator.addVertex(x + width + 0.5D + 1.0D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ);
	tessellator.draw();

	if (tebb.renderAll) GL11.glEnable(GL11.GL_DEPTH_TEST);

	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
}
    }

}

Posted

Hi

 

I'd guess that probably one of the OpenGL flags isn't set right.

 

Perhaps

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

?

 

I wrote a brief class to print the current OpenGL settings, that might help figure out which flag(s) are different when the mob is in view vs when it isn't in view.

Some more info here plus the link

http://www.minecraftforge.net/forum/index.php/topic,16562.msg84272.html#msg84272

 

-TGG

Posted

Just tried the flag but didn't make any difference.

 

I also used your debugger, outputs were both the same.

 

When looking at mobs

 

  Reveal hidden contents

 

 

When not looking at mobs

 

  Reveal hidden contents

 

Posted

I found the problem. I took a look at the rendering of the beacon beam. Just played around with chucking some of the flags from that render. I needed to add this flag in.

GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);

 

Thanks for your help anyway :)

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.