Texture on only one side/face of box
Texture on only one side/face of box
Hi there,
I've been searching the forums for some info on this and didn't turn up anything.
I have a simple rectangular box and I'd like to apply a texture just to one side.
I'd like to do it programatically rather than in a modeling program since the program will eventually have an editor where someone could change select a different image to put on it.
Is this possible?
any info would be awesome,
~telengard
I've been searching the forums for some info on this and didn't turn up anything.
I have a simple rectangular box and I'd like to apply a texture just to one side.
I'd like to do it programatically rather than in a modeling program since the program will eventually have an editor where someone could change select a different image to put on it.
Is this possible?
any info would be awesome,
~telengard
Still stuck in the 1980s. My mame cabinet and 8 bit game room:
http://users.adelphia.net/~bsturk
http://users.adelphia.net/~bsturk
-
ansu832001
- Posts: 95
- Joined: Thu Mar 01, 2007 6:39 am
Hi,
Are you Creating this Rectangle box as four different Planes(Objects),if so then on MouseDown get the object selected and apply texture as
selectedObj.GetMaterial(0).Texture1=device.VideoDriver.GetTexture(ImagePath);
the above code is in .NET,you can easily convert the same to C++.
Best Regards.
Are you Creating this Rectangle box as four different Planes(Objects),if so then on MouseDown get the object selected and apply texture as
selectedObj.GetMaterial(0).Texture1=device.VideoDriver.GetTexture(ImagePath);
the above code is in .NET,you can easily convert the same to C++.
Best Regards.
Hi there,ansu832001 wrote:Hi,
Are you Creating this Rectangle box as four different Planes(Objects),if so then on MouseDown get the object selected and apply texture as
selectedObj.GetMaterial(0).Texture1=device.VideoDriver.GetTexture(ImagePath);
the above code is in .NET,you can easily convert the same to C++.
Best Regards.
Thanks for the response.
I'm just adding a cube like this
ISceneNode* node = smgr->addCubeSceneNode( 1000, NULL, -1, vector3df( 0, 0, 0 ), vector3df( 0, 0, 0 ), vector3df( 100.0f, 0.1f, 100.0f ) );
I've also tried w/ a model I exported from blender in 3ds format.
The key is I need to programatically do this. So selecting with a mouse isn't an option.
~telengard
Still stuck in the 1980s. My mame cabinet and 8 bit game room:
http://users.adelphia.net/~bsturk
http://users.adelphia.net/~bsturk
-
ansu832001
- Posts: 95
- Joined: Thu Mar 01, 2007 6:39 am
On the top is where I'd like it, but I have no idea how to do it.ansu832001 wrote:Hi,How do you decide which side to ApplyTexture??
Best Regards.
~telengard
Still stuck in the 1980s. My mame cabinet and 8 bit game room:
http://users.adelphia.net/~bsturk
http://users.adelphia.net/~bsturk
You can't acomplish what you want with cube you get with addCubeSceneNode function.
Firsth because there is no way howe to acces UV coordinates of indiviadual cube vertices.
Second because even if you could sides of this cube share vertices between each other.
There are two ways to go:
1. model your own cube and load it. cube sides should not share vertices so you can set UV coordinates of sides independently. You also may want to make each side to use its own material. One material per side.
2. create your own custom cube scene node.
Look here for inspiration:
http://irrlicht.sourceforge.net/tut003.html
or here:
http://irrlicht.sourceforge.net/phpBB2/ ... light=cube
Firsth because there is no way howe to acces UV coordinates of indiviadual cube vertices.
Second because even if you could sides of this cube share vertices between each other.
There are two ways to go:
1. model your own cube and load it. cube sides should not share vertices so you can set UV coordinates of sides independently. You also may want to make each side to use its own material. One material per side.
2. create your own custom cube scene node.
Look here for inspiration:
http://irrlicht.sourceforge.net/tut003.html
or here:
http://irrlicht.sourceforge.net/phpBB2/ ... light=cube
-
ansu832001
- Posts: 95
- Joined: Thu Mar 01, 2007 6:39 am
Okie,Create the Rectangle as Four Different Planes
p1(left)+p2(top)+p3(right)+p4(bottom)=Rectangle.
Now Apply Texture to any one of the Plane(note,plane is also an Object)
Note : each plane is created as two Triangles
i'll give you idea for creating one plane
Vertex Buffer= { define our points}
index Buffer={Define the triangles}
in the above manner add four planes,but to directly apply texture to only one side of cube(created as AddCubeSceneNode) you have to play with Texture Coordinates.
Hope this is clear
p1(left)+p2(top)+p3(right)+p4(bottom)=Rectangle.
Now Apply Texture to any one of the Plane(note,plane is also an Object)
Note : each plane is created as two Triangles
i'll give you idea for creating one plane
Vertex Buffer= { define our points}
index Buffer={Define the triangles}
in the above manner add four planes,but to directly apply texture to only one side of cube(created as AddCubeSceneNode) you have to play with Texture Coordinates.
Hope this is clear
-
ansu832001
- Posts: 95
- Joined: Thu Mar 01, 2007 6:39 am
iam soory i forgot that,i was in some other world while posting this,anyway now i correct myself......Create the Rectangle as six Different Planes
p1(left)+p2(top)+p3(right)+p4(bottom)+p5(front)+p6(back)=Rectangle.
Now Apply Texture to any one of the Plane(note,plane is also an Object)
Note : each plane is created as two Triangles
i'll give you idea for creating one plane
Vertex Buffer= { define our points}
index Buffer={Define the triangles}
in the above manner add four planes,but to directly apply texture to only one side of cube(created as AddCubeSceneNode) you have to play with Texture Coordinates.
Hope this is clear
p1(left)+p2(top)+p3(right)+p4(bottom)+p5(front)+p6(back)=Rectangle.
Now Apply Texture to any one of the Plane(note,plane is also an Object)
Note : each plane is created as two Triangles
i'll give you idea for creating one plane
Vertex Buffer= { define our points}
index Buffer={Define the triangles}
in the above manner add four planes,but to directly apply texture to only one side of cube(created as AddCubeSceneNode) you have to play with Texture Coordinates.
Hope this is clear
Ahh, 4 planes is a good idea, or just one plane on top of my rectangle (directly) although that is still 2 sides for each plane. Great idea! I'll read up on Texture Coords.ansu832001 wrote:Okie,Create the Rectangle as Four Different Planes
p1(left)+p2(top)+p3(right)+p4(bottom)=Rectangle.
Now Apply Texture to any one of the Plane(note,plane is also an Object)
Note : each plane is created as two Triangles
i'll give you idea for creating one plane
Vertex Buffer= { define our points}
index Buffer={Define the triangles}
in the above manner add four planes,but to directly apply texture to only one side of cube(created as AddCubeSceneNode) you have to play with Texture Coordinates.
Hope this is clear
~telengard
Still stuck in the 1980s. My mame cabinet and 8 bit game room:
http://users.adelphia.net/~bsturk
http://users.adelphia.net/~bsturk