Texture doesn't show (right)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
whisp
Posts: 17
Joined: Sat Jan 09, 2010 1:58 pm

Texture doesn't show (right)

Post by whisp »

I'm desperately trying to have my very first own 3d object textured, but the texture doesn't show up.

It's a quadratic arranged trianglelist. 50*50 squares, respectively 5000 Triangles.

I started with the CustomSceneNode Tutorial and did some changes in it. The Render-Method looks the following:

Code: Select all

virtual void render()
{
	video::IVideoDriver* driver = SceneManager->getVideoDriver();

	driver->setMaterial(Material);
	driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
	driver->drawIndexedTriangleList(&Vertices[0], tdVerts, &indices[0], tdTriangles);
}
The Material is defined by the following lines:

Code: Select all

Material.Wireframe = false;
Material.Lighting = false;
Material.setTexture(0, driver->getTexture("Grafics/terrain-texture.jpg"));
Without a texture loaded, the Square shows up light blue, with the texture loaded, the Square shows up dark green, but not with the actual texture (which should be the same used in the irrlicht terrain tutorial).

Did i miss something important? Or should i search the problem in another method? Any hints? Thanks!

whisp
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

did you set the texture coordinates proper for the vertices ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
whisp
Posts: 17
Joined: Sat Jan 09, 2010 1:58 pm

Post by whisp »

That was all. I used the same UV coordinates for every single vertex. Now it works. :oops: Thanks!

In that moment another question is coming up tho:

My trianglelist is representing a square that is set up by lots of small squares (50*50). Each of this small squares shall only use a small, specific part of a 512*512-Texture. The small squares share the vertices with their neighbour squares tho, thus i wonder if there's some way to asign multiple UV coordinates per vertex or some other workaround. Or is the only way to have 4 individual vertices per square?

whisp
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, that's the only way.
whisp
Posts: 17
Joined: Sat Jan 09, 2010 1:58 pm

Post by whisp »

Thanks, hybrid!
Post Reply