Posted October 17, 201312 yr 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 () { } @Override public void doRender(Entity entity, double par2, double par4, double par6,float f, float f1) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); //GL11.glEnable(GL11.GL_BLEND); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); //GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); Tessellator tessellator = Tessellator.instance; tessellator.startDrawing(GL11.GL_QUADS); tessellator.setColorRGBA(0, 0, 0, 128); tessellator.setNormal(0, 0, 0); //front tessellator.addVertex(0, 0, 0); tessellator.addVertex(0, 1, 0); tessellator.addVertex(1, 1, 0); tessellator.addVertex(1, 0, 0); //back tessellator.addVertex(1, 0, 1); tessellator.addVertex(1, 1, 1); tessellator.addVertex(0, 1, 1); tessellator.addVertex(0, 0, 1); tessellator.draw(); GL11.glPopMatrix(); // GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); } @Override 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 Thanks
October 18, 201312 yr Hi 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... -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.