Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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();

}

}

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.