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

Hello,

 

I'm trying to bind a texture to a face of a obj model with UV Mapping (Blender).

So, it works in Blender and i exported the model to an obj.

 

In Minecraft i'm binding the texture like this:

 

FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("brickcraft", "/textures/test.png"));

 

But when i open Minecraft my block looks like this (what actually looks kinda cool :P):

 

width=800 height=640http://i.imagebanana.com/img/enn8yv30/20131011_18.12.17.png[/img]

 

It looks the same even if i don't bind a texture to it.

The console doesn't say that it can't find the texture.

 

I'm guessing i'm doing something wrong in Blender.

 

Thanks in advance!

 

ss7

You sir are a god damn hero.

When do you bind the texture? Right before you do the render call, or does it happen to be after it?

Would be easy to clear up this if we could see the rendering file :)

If you guys dont get it.. then well ya.. try harder...

  • Author

Hello,

 

Here is my rendering code:

 

MODEL:

 

public void Render(TileEntity par1Entity, double x, double y, double z)
{
    GL11.glPushMatrix();
    
    GL11.glTranslatef((float)x + 0.5F, (float)y + 0.5F, (float)z + 0.5F);
    
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("brickcraft", "/textures/test.png"));
    
    model.renderAll();
    
    GL11.glPopMatrix();
}

 

TESR:

 

@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f)
{
	new TestModel().Render(tileentity, d0, d1, d2);
}

 

ss7

You sir are a god damn hero.

  • Author

Hello,

 

It doesn't work either. But why should i do this? I've done it like this in ALL of my Blocks and it worked in ALL of my Blocks.

 

So why should i do this? My method is faster.

 

ss7

You sir are a god damn hero.

Hi

 

It looks to me like your object is rendering using the default block texture sheet instead of your new texture.  Are you sure that your renderAll isn't rebinding the texture back to block perhaps?

 

Perhaps you could test this by drawing a rectangle using the tessellator immediately after your bindTexture.  If it works, at least you know your resource has been properly located.

 

-TGG

  • Author

Hello,

 

I've tried to render a rectangle with the Tesselator but even that doesn't worked.

 

Here is my code:

 

Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0,1);
        tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1);
        tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1,0);
        tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0);
        tessellator.draw();

 

Maybe i'm doing something wrong there, because i'm new to rendering.

 

ss7

You sir are a god damn hero.

  • Author

Hello,

 

When i bind no texture to it and try opening the GUI of my block and taking out the item that was in there, it's rendering another image.

 

width=800 height=640http://i.imagebanana.com/img/2vaf9tav/20131012_12.19.45.png[/img]

 

When i bind a texture to it it looks like this:

 

http://youtu.be/qT0IOXn5__E

 

EDIT: OH MAN!!! That was just the wrong block that i was looking at!

 

Sorry!

 

This is now

 

SOLVED

 

ss7

You sir are a god damn hero.

Welcome to the world of programming,

facepalm's are quite frequent when debugging, but hey that's the life of a programmer :D

If you guys dont get it.. then well ya.. try harder...

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.