Jump to content

[Solved] Custom model with semi-transparent texture randomly flashes white


Silly511

Recommended Posts

I have a custom model that has a semi-transparent texture, but for some reason the model randomly flashes white. Why is this? Heres a imgur album showing what happens:

And heres my render code:

 

public class CrystalRender extends TileEntitySpecialRenderer {

ResourceLocation modelTexture = new ResourceLocation(EnchantedAura.modid + ":textures/blocks/AuraCrystal.png");
ResourceLocation objModelLocation = new ResourceLocation(EnchantedAura.modid + ":models/Crystal.obj");
    IModelCustom model = AdvancedModelLoader.loadModel(objModelLocation);

@Override
public void renderTileEntityAt(TileEntity tile, double posX, double posY, double posZ, float thing) {

	int rot = 1;
	float Xoffset = 0;
	float Yoffset = 0;
	float Zoffset = 0;

	if (!(tile.getWorldObj() == null)) {
		rot = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
	}

	if (rot == 0) {
		Yoffset = 0.5F;
	} else if (rot == 1) {
		Yoffset = -0.5F;
	} else if (rot == 2) {
		Zoffset = 0.5F;
	} else if (rot == 3) {
		Zoffset = -0.5F;
	} else if (rot == 4) {
		Xoffset = 0.5F;
	} else if (rot == 5) {
		Xoffset = -0.5F;
	}

	GL11.glPushMatrix();
	GL11.glColor3f(1.0F, 1.0F, 1.0F);
	GL11.glTranslated(posX + Xoffset + 0.5F, posY + Yoffset + 0.5F, posZ + Zoffset + 0.5F);

	if (rot == 0) {
		GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
	} else if (rot == 2) {
		GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
	} else if (rot == 3) {
		GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
	} else if (rot == 4) {
		GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
	} else if (rot == 5) {
		GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
	}

	if (tile.getWorldObj() != null) {
		GL11.glScalef(2F, 2F, 2F);
	} else {
		GL11.glScalef(3.5F, 3.5F, 3.5F);
	}

	FMLClientHandler.instance().getClient().renderEngine.bindTexture(modelTexture);

	GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glEnable(GL11.GL_BLEND);

	model.renderAll();

	GL11.glDisable(GL11.GL_BLEND);
	GL11.glPopAttrib();
	GL11.glPopMatrix();

}

}

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.