Jump to content

[1.7.10] TileEntitySpecialRenderer Rendering problem


a3626a

Recommended Posts

Hello

I'm trying to render custom tile entity with tessellator (not with ModelBase class)

but the problem is texture(or lighting)

 

The rendered tile entity has proper 3D Model, but texture.

it's interesting that the texture sometimes rendered properly(but dark) with certain player's view(angle). It sometimes becomes white, black, brown, and pink.

 

glColor4f(1.0f , 1.0f, 1.0f, 1.0f) doesn't work for me. No effect.

 

public class TEMillStoneRenderer extends TileEntitySpecialRenderer{
private int light;

@Override
public void renderTileEntityAt(TileEntity te, double x,
		double y, double z, float p_147500_8_) {

	GL11.glPushMatrix();
        GL11.glTranslatef((float)x, (float)y, (float)z);
        TEMillStone tileEntityYour = (TEMillStone)te;
        renderMillStone(tileEntityYour, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, ModBlocks.millStone);
        GL11.glPopMatrix();

}

public void renderMillStone(TEMillStone tl, World world, int i, int j, int k, Block block) {

        Block material = tl.getMaterial();
        
        GL11.glPushMatrix();
        
        	GL11.glTranslatef(0.5F, 0, 0.5F);
        	GL11.glRotatef(tl.getRotation(), 0F, 1F, 0F);
        	GL11.glTranslatef(-0.5F, 0, -0.5F);
   
        	GL11.glPushMatrix();
        	
        		GL11.glTranslatef(1F, 1F, 0F);
        		
        		GL11.glPushMatrix();
        		
        			GL11.glTranslatef(0.5F, 0, 0.5F);
        			GL11.glRotatef(0F, 0F, 1F, 0F);
        			GL11.glTranslatef(-0.5F, 0, -0.5F);
        			
        			RenderBlock(material);
        			
        		GL11.glPopMatrix();
        		
        	GL11.glPopMatrix();
        	
        	
        	GL11.glPushMatrix();
        	
        		GL11.glTranslatef(0F, 1F, 0F);
    		
        		GL11.glPushMatrix();
    		
    				GL11.glTranslatef(0.5F, 0, 0.5F);
    				GL11.glRotatef(90F, 0F, 1F, 0F);
    				GL11.glTranslatef(-0.5F, 0, -0.5F);
    			
    				RenderBlock(material);
    			
    			GL11.glPopMatrix();
    			
   			GL11.glPopMatrix();
    		
        	GL11.glPushMatrix();
        	
    			GL11.glTranslatef(0F, 1F, 1F);
    		
    			GL11.glPushMatrix();
    		
    				GL11.glTranslatef(0.5F, 0, 0.5F);
    				GL11.glRotatef(180F, 0F, 1F, 0F);
    				GL11.glTranslatef(-0.5F, 0, -0.5F);
    			
    				RenderBlock(material);
    			
    				GL11.glPopMatrix();
    		
		GL11.glPopMatrix();
    				
        	GL11.glPushMatrix();
        	
    			GL11.glTranslatef(1F, 1F, 1F);
    		
    			GL11.glPushMatrix();
    		
    				GL11.glTranslatef(0.5F, 0, 0.5F);
    				GL11.glRotatef(270F, 0F, 1F, 0F);
    				GL11.glTranslatef(-0.5F, 0, -0.5F);
    			
    				RenderBlock(material);
    			
    			GL11.glPopMatrix();
    		
    		GL11.glPopMatrix();
        
        GL11.glPopMatrix();
        
        GL11.glPushMatrix();
    	
	GL11.glTranslatef(1F, 0F, 0F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(0F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

	GL11.glPopMatrix();

GL11.glPopMatrix();


GL11.glPushMatrix();

	GL11.glTranslatef(0F, 0F, 0F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(90F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

	GL11.glPopMatrix();

	GL11.glPopMatrix();

GL11.glPushMatrix();

	GL11.glTranslatef(0F, 0F, 1F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(180F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

		GL11.glPopMatrix();

GL11.glPopMatrix();

GL11.glPushMatrix();

	GL11.glTranslatef(1F, 0F, 1F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(270F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

	GL11.glPopMatrix();

GL11.glPopMatrix();
}

        

    private void RenderBlock(Block material) {
    	
    	IIcon c;
		float u, v, U, V;
		double[] tempX;
		double[] tempY;
		double[] tempZ;
		double[] tempU;
		double[] tempV;
		c = material.getIcon(0, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 0.5, 1, 1, 0, 0 };
	tempY = new double[] { 0, 0, 0, 0, 0 };
	tempZ = new double[] { 0, 0.5, 1, 1, 0 };
		tempU = new double[] { (u + U) / 2.0, U, U, u, u };
		tempV = new double[] { v, (v + V) / 2.0, V, V, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);
		c = material.getIcon(1, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 0, 0, 1, 1, 0.5 };
	tempY = new double[] { 1, 1, 1, 1, 1 };
	tempZ = new double[] { 0, 1, 1, 0.5, 0 };
		tempU = new double[] { u, u, U, U, (u + U) / 2.0 };
		tempV = new double[] { v, V, V, (v + V) / 2.0, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);

	c = material.getIcon(3, 0);
	u = c.getMinU();
	v = c.getMinV();
	U = c.getMaxU();
	V = c.getMaxV();

		tempX = new double[] { 1, 1, 0.5, 0.5 };
		tempY = new double[] { 1, 0, 0, 1 };
		tempZ = new double[] { 0.5, 0.5, 0, 0 };
		tempU = new double[] { u, u, U, U };
		tempV = new double[] { v, V, V, v };
		drawQuad(tempX, tempY, tempZ, tempU, tempV);

		c = material.getIcon(5, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 1, 1, 1, 1 };
		tempY = new double[] { 1, 0, 0, 1 };
		tempZ = new double[] { 1, 1, 0.5, 0.5 };
		tempU = new double[] { (u + U) / 2.0, (u + U) / 2.0, U, U };
		tempV = new double[] { v, V, V, v };
		drawQuad(tempX, tempY, tempZ, tempU, tempV);

		c = material.getIcon(2, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 0.5, 0.5, 0, 0 };
		tempY = new double[] { 1, 0, 0, 1 };
		tempZ = new double[] { 0, 0, 0, 0 };
		tempU = new double[] { (u + U) / 2.0, (u + U) / 2.0, U, U };
		tempV = new double[] { v, V, V, v };
		drawQuad(tempX, tempY, tempZ, tempU, tempV);

}

public void drawTri(double[] X, double[] Y,
		double[] Z, double[] U, double[] V) {
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawing(GL11.GL_TRIANGLES);
	for (int i = 0; i < 3; i++) {
		tessellator.addVertexWithUV(X[i], Y[i], Z[i], U[i], V[i]);
	}

	tessellator.draw();
}


public void drawQuad(double[] X, double[] Y,
		double[] Z, double[] U, double[] V) {
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawing(GL11.GL_QUADS);
	for (int i = 0; i < 4; i++) {
		tessellator.addVertexWithUV(X[i], Y[i], Z[i], U[i], V[i]);
	}

	tessellator.draw();
}


public void drawPolygon(double[] X, double[] Y,
		double[] Z, double[] U, double[] V) {
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawing(GL11.GL_POLYGON);
	for (int i = 0; i < X.length; i++) {

		tessellator.addVertexWithUV(X[i], Y[i], Z[i], U[i], V[i]);
	}

	tessellator.draw();
}

}

Link to comment
Share on other sites

Try this after pushing matrix:

GL11.glDisable(GL11.GL_CULL_FACE);
Tessellator tessellator = Tessellator.instance;
int brightness = tileentity.getBlockType().getMixedBrightnessForBlock(tileentity.getWorldObj(), tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
tessellator.setBrightness(brightness);
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);

Link to comment
Share on other sites

I think it's because you are pushing the matrix more then once.

 

 

does it matter?

 

I don't know about advanced concept of OpenGL, I just use push/pop matrix method to transformer(translation, rotation) the model(vertex).

And I get the model that i want, but texture. As player's view point, the texture sometimes is rendered properly, and sometimes not.

 

 

 

 

Try this after pushing matrix:

GL11.glDisable(GL11.GL_CULL_FACE);
Tessellator tessellator = Tessellator.instance;
int brightness = tileentity.getBlockType().getMixedBrightnessForBlock(tileentity.getWorldObj(), tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
tessellator.setBrightness(brightness);
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);

 

Where should I insert?

I have too many "glPushMatrix"

Link to comment
Share on other sites

I think you should read about consept of the OpenGL. Do some googling to find out how OpenGL works, how and when you should use glPushMatrix. You asked where to insert that piece of code, well, you should insert it so that it would be applied to parts that has lighting issues.

Link to comment
Share on other sites

I just learn some basic concepts of OpenGL. I use glPushMatrix correctly (to transform matrix). GL11.glDisable(GL11.GL_CULL_FACE) could be inserted anywhere in my code, but setBrightness, setColorOpque_F shoud be placed before tessellator.draw(). I set the orientation correctly so I don't need to disable GL11.GL_CULL_FACE.

 

When I created a world, My model is rendered correctly a while, but after a while, it becomes strange.

 

This is the image of proper rendering and wrong rendering.

http://imgur.com/fYemWxM,J1iahuf#1

 

this depends on player's view point.

Link to comment
Share on other sites

Hi

 

I think that if you're using the Tessellator you should change settings on the Tessellator, not using OpenGL.

 

For example

 

    	tess.startDrawingQuads(); //Starts drawing

    	int brightness = myBlock.getMixedBrightnessForBlock(world, tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
tess.setBrightness(brightness);
tess.setColorOpaque_F(1.0F, 1.0F, 1.0F);

 

To be honest, I'm not sure that's the actual problem.  The intermittent loss of texture is pretty strange since you're using addVertexWithUV() and from memory that should turn on texturing every time.

 

You might also find this class useful;

https://github.com/TheGreyGhost/SpeedyTools/blob/master/src/speedytools/common/utilities/OpenGLdebugging.java

 

I've used it in the past to check what the OpenGL settings are; it's not complete, but dumpAllIsEnabled() works and has showed up problems for me before- dump for a good render, dump for a bad render, and spot the difference.  Not sure it is likely to help you in this case, but it might be worth a go.

 

-TGG

 

 

 

Link to comment
Share on other sites

I just checked images you posted and I see that it's not the lighting problem as I thought (Except if it renders as it should but it becomes dark when player watches it from certain angles).

How does this problem happen exactly? Does your texture change as shown in your images when changing view angle or how? When it changes does it change back (flickers between correct texture and abnormal texture)?

Link to comment
Share on other sites

I changed my code a little bit,

public class TEMillStoneRenderer extends TileEntitySpecialRenderer{
private int light;
private TEMillStone tileentity;

@Override
public void renderTileEntityAt(TileEntity tileentity, double x,
		double y, double z, float p_147500_8_) {
	//OpenGLdebugging.dumpAllIsEnabled();

	this.tileentity = (TEMillStone) tileentity;
	GL11.glPushMatrix();
	GL11.glTranslatef((float)x, (float)y, (float)z);
        TEMillStone tileEntityYour = (TEMillStone)tileentity;
        renderMillStone(tileEntityYour, tileentity.getWorldObj(), tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, ModBlocks.millStone);
        GL11.glPopMatrix();

}

public void renderMillStone(TEMillStone tl, World world, int i, int j, int k, Block block) {

        Block material = tl.getMaterial();
        
        GL11.glPushMatrix();
        
        	GL11.glTranslatef(0.5F, 0, 0.5F);
        	GL11.glRotatef(tl.getRotation(), 0F, 1F, 0F);
        	GL11.glTranslatef(-0.5F, 0, -0.5F);
   
        	GL11.glPushMatrix();
        	
        		GL11.glTranslatef(1F, 1F, 0F);
        		
        		GL11.glPushMatrix();
        		
        			GL11.glTranslatef(0.5F, 0, 0.5F);
        			GL11.glRotatef(0F, 0F, 1F, 0F);
        			GL11.glTranslatef(-0.5F, 0, -0.5F);
        			
        			RenderBlock(material);
        			
        		GL11.glPopMatrix();
        		
        	GL11.glPopMatrix();
        	
        	
        	GL11.glPushMatrix();
        	
        		GL11.glTranslatef(0F, 1F, 0F);
    		
        		GL11.glPushMatrix();
    		
    				GL11.glTranslatef(0.5F, 0, 0.5F);
    				GL11.glRotatef(90F, 0F, 1F, 0F);
    				GL11.glTranslatef(-0.5F, 0, -0.5F);
    			
    				RenderBlock(material);
    			
    			GL11.glPopMatrix();
    			
   			GL11.glPopMatrix();
    		
        	GL11.glPushMatrix();
        	
    			GL11.glTranslatef(0F, 1F, 1F);
    		
    			GL11.glPushMatrix();
    		
    				GL11.glTranslatef(0.5F, 0, 0.5F);
    				GL11.glRotatef(180F, 0F, 1F, 0F);
    				GL11.glTranslatef(-0.5F, 0, -0.5F);
    			
    				RenderBlock(material);
    			
    				GL11.glPopMatrix();
    		
		GL11.glPopMatrix();
    				
        	GL11.glPushMatrix();
        	
    			GL11.glTranslatef(1F, 1F, 1F);
    		
    			GL11.glPushMatrix();
    		
    				GL11.glTranslatef(0.5F, 0, 0.5F);
    				GL11.glRotatef(270F, 0F, 1F, 0F);
    				GL11.glTranslatef(-0.5F, 0, -0.5F);
    			
    				RenderBlock(material);
    			
    			GL11.glPopMatrix();
    		
    		GL11.glPopMatrix();
        
        GL11.glPopMatrix();
        
        GL11.glPushMatrix();
    	
	GL11.glTranslatef(1F, 0F, 0F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(0F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

	GL11.glPopMatrix();

GL11.glPopMatrix();


GL11.glPushMatrix();

	GL11.glTranslatef(0F, 0F, 0F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(90F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

	GL11.glPopMatrix();

	GL11.glPopMatrix();

GL11.glPushMatrix();

	GL11.glTranslatef(0F, 0F, 1F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(180F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

		GL11.glPopMatrix();

GL11.glPopMatrix();

GL11.glPushMatrix();

	GL11.glTranslatef(1F, 0F, 1F);

	GL11.glPushMatrix();

		GL11.glTranslatef(0.5F, 0, 0.5F);
		GL11.glRotatef(270F, 0F, 1F, 0F);
		GL11.glTranslatef(-0.5F, 0, -0.5F);

		RenderBlock(material);

	GL11.glPopMatrix();

GL11.glPopMatrix();
}

    private void RenderBlock(Block material) {
    	
    	
    	
    	IIcon c;
		float u, v, U, V;
		double[] tempX;
		double[] tempY;
		double[] tempZ;
		double[] tempU;
		double[] tempV;
		c = material.getIcon(0, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 0.5, 1, 1, 0, 0 };
	tempY = new double[] { 0, 0, 0, 0, 0 };
	tempZ = new double[] { 0, 0.5, 1, 1, 0 };
		tempU = new double[] { (u + U) / 2.0, U, U, u, u };
		tempV = new double[] { v, (v + V) / 2.0, V, V, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);

		c = material.getIcon(1, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 0, 0, 1, 1, 0.5 };
	tempY = new double[] { 1, 1, 1, 1, 1 };
	tempZ = new double[] { 0, 1, 1, 0.5, 0 };
		tempU = new double[] { u, u, U, U, (u + U) / 2.0 };
		tempV = new double[] { v, V, V, (v + V) / 2.0, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);

	c = material.getIcon(3, 0);
	u = c.getMinU();
	v = c.getMinV();
	U = c.getMaxU();
	V = c.getMaxV();

		tempX = new double[] { 1, 1, 0.5, 0.5 };
		tempY = new double[] { 1, 0, 0, 1 };
		tempZ = new double[] { 0.5, 0.5, 0, 0 };
		tempU = new double[] { u, u, U, U };
		tempV = new double[] { v, V, V, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);

		c = material.getIcon(5, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 1, 1, 1, 1 };
		tempY = new double[] { 1, 0, 0, 1 };
		tempZ = new double[] { 1, 1, 0.5, 0.5 };
		tempU = new double[] { (u + U) / 2.0, (u + U) / 2.0, U, U };
		tempV = new double[] { v, V, V, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);

		c = material.getIcon(2, 0);
		u = c.getMinU();
		v = c.getMinV();
		U = c.getMaxU();
		V = c.getMaxV();

		tempX = new double[] { 0.5, 0.5, 0, 0 };
		tempY = new double[] { 1, 0, 0, 1 };
		tempZ = new double[] { 0, 0, 0, 0 };
		tempU = new double[] { (u + U) / 2.0, (u + U) / 2.0, U, U };
		tempV = new double[] { v, V, V, v };
		drawPolygon(tempX, tempY, tempZ, tempU, tempV);

}


public void drawPolygon(double[] X, double[] Y,
		double[] Z, double[] U, double[] V) {
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawing(GL11.GL_POLYGON);
	int brightness = tileentity.getBlockType().getMixedBrightnessForBlock(tileentity.getWorldObj(), tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
	tessellator.setBrightness(brightness);
	tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
	double[] temp = cross(X[1]-X[0],Y[1]-Y[0],Z[1]-Z[0],X[2]-X[0],Y[2]-Y[0],Z[2]-Z[0]);
	tessellator.setNormal((float)temp[0], (float)temp[1], (float)temp[2]);

	for (int i = 0; i < X.length; i++) {

		tessellator.addVertexWithUV(X[i], Y[i], Z[i], U[i], V[i]);
	}

	tessellator.draw();
}

public double[] cross(double x1, double y1, double z1,double x2, double y2, double z2) {
	double[] ret = new double[3];
	ret[0] = y1*z2 - z1*y2;
	ret[1] = z1*x2 - x1*z2;
	ret[2] = x1*y2 - y1*x2;
	double mag = Math.sqrt(ret[0]*ret[0] + ret[1]*ret[1] + ret[2]*ret[2]);
	ret[0] /= mag;
	ret[1] /= mag;
	ret[2] /= mag;
	return ret;
}	
}

 

but the problem still occurs.

 

The texture changes immediately as I move my view angle. Furthermore, the texturing directly depends on player's view angle. It means there is a special interval of view angle that the texture renders well.

 

Also I try dump, but there's no differences between them.

:

GL_VERTEX_ARRAY:false (Vertex array enable)

GL_NORMAL_ARRAY:false (Normal array enable)

GL_COLOR_ARRAY:false (RGBA color array enable)

GL_INDEX_ARRAY:false (Color-index array enable)

GL_TEXTURE_COORD_ARRAY:false (Texture coordinate array enable)

GL_EDGE_FLAG_ARRAY:false (Edge flag array enable)

GL_NORMALIZE:false (Current normal normalization on/off)

GL_FOG:true (True if fog enabled)

GL_LIGHTING:true (True if lighting is enabled)

GL_COLOR_MATERIAL:true (True if color tracking is enabled)

GL_LIGHT0:true (True if light 0 enabled)

GL_LIGHT1:true (True if light 1 enabled)

GL_LIGHT2:false (True if light 2 enabled)

GL_LIGHT3:false (True if light 3 enabled)

GL_LIGHT4:false (True if light 4 enabled)

GL_LIGHT5:false (True if light 5 enabled)

GL_LIGHT6:false (True if light 6 enabled)

GL_LIGHT7:false (True if light 7 enabled)

GL_POINT_SMOOTH:false (Point antialiasing on)

GL_LINE_SMOOTH:false (Line antialiasing on)

GL_LINE_STIPPLE:false (Line stipple enable)

GL_CULL_FACE:true (Polygon culling enabled)

GL_POLYGON_SMOOTH:false (Polygon antialiasing on)

GL_POLYGON_OFFSET_POINT:false (Polygon offset enable for GL_POINT mode rasterization)

GL_POLYGON_OFFSET_LINE:false (Polygon offset enable for GL_LINE mode rasterization)

GL_POLYGON_OFFSET_FILL:false (Polygon offset enable for GL_FILL mode rasterization)

GL_POLYGON_STIPPLE:false (Polygon stipple enable)

GL_TEXTURE_1D:false (True if 1-D texturing enabled )

GL_TEXTURE_2D:true (True if 2-D texturing enabled )

GL_TEXTURE_GEN_S:false (Texgen enabled (x is S, T, R, or Q))

GL_TEXTURE_GEN_T:false (Texgen enabled (x is S, T, R, or Q))

GL_TEXTURE_GEN_R:false (Texgen enabled (x is S, T, R, or Q))

GL_TEXTURE_GEN_Q:false (Texgen enabled (x is S, T, R, or Q))

GL_SCISSOR_TEST:false (Scissoring enabled)

GL_ALPHA_TEST:true (Alpha test enabled)

GL_STENCIL_TEST:false (Stenciling enabled)

GL_DEPTH_TEST:true (Depth buffer enabled)

GL_BLEND:false (Blending enabled)

GL_DITHER:true (Dithering enabled)

GL_INDEX_LOGIC_OP:false (Color index logical operation enabled)

GL_COLOR_LOGIC_OP:false (RGBA color logical operation enabled)

GL_AUTO_NORMAL:false (True if automatic normal generation enabled)

 

 

I think the problem is getIcon(Maybe...).

getIcon is made for block rendering, not tileentity.

but for some reasons I use getIcon(I want to use vanila block's texture).

 

I would try typical way to bind texture.

 

Link to comment
Share on other sites

I got an idea that you could try. It seems like you are rendering your model part by part. Try render only one part first and comment out everything else (means that you would call getIcon(...) only once in render code). Check if it renders correctly then and if so, include next piece of model to be rendered. This could help you to determinate where the actual problem is or does the problem apply to whole rendering code.

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.



×
×
  • Create New...

Important Information

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