Jump to content

Problem Rendering Entities


Recommended Posts

Hello all,


I've been having trouble rendering an entity in forge, and I'm not quite sure what the problem is.

I have it rendering 2 faces of a cube, but whenever i look at a certain angle the cube disappears. It seems that it is only visible from the orientation 102(west) through -152(north)



here is the code inside of my "Render" file


package over.extrashapes;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;

public class ShapeRender extends Render {

ResourceLocation texture = null;
public ShapeRender ()

public void doRender(Entity entity, double par2, double par4, double par6,float f, float f1) {
	// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

	   GL11.glTranslatef((float)par2, (float)par4, (float)par6);

           Tessellator tessellator = Tessellator.instance;
           tessellator.setColorRGBA(0, 0, 0, 128);
	   tessellator.setNormal(0, 0, 0);
           tessellator.addVertex(0, 0, 0);
           tessellator.addVertex(0, 1, 0);
           tessellator.addVertex(1, 1, 0);
           tessellator.addVertex(1, 0, 0);
           tessellator.addVertex(1, 0, 1);
           tessellator.addVertex(1, 1, 1);
           tessellator.addVertex(0, 1, 1);
           tessellator.addVertex(0, 0, 1);

	  // GL11.glDisable(GL11.GL_BLEND);


protected ResourceLocation getEntityTexture(Entity entity) {
	// TODO Auto-generated method stub
	return null;



any suggestions or solutions would be awesome, this has been haunting me for a couple days



Link to comment
Share on other sites



So I gather your entity is that big black shape on the left?


When the entity disappears, do you know for certain that the renderer has drawn it?  I.e. perhaps it is being culled by the frustrum code and it never gets to the renderer?  (I suggest adding some println to check)


I can't see anything wrong with the render code but then I'm no expert.  I've previously had rather strange bugs where my render varied depending on what else had previously been rendered in the same scene, because I wasn't setting all the necessary settings. 


Fresh out of other ideas, sorry...



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.

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.


  • Create New...

Important Information

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