Posted April 23, 20169 yr 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(); } }
April 23, 20169 yr Author Never mind, I figured it out. All I had to do was add GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); before GL11.glEnable(GL11.GL_BLEND);
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.