Jump to content

OBJ Model Bind Texture


ss7

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.