Texture upside-down in Billboards

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
mightypanda
Posts: 8
Joined: Wed Oct 06, 2004 2:04 pm
Location: Bologna, Italy
Contact:

Texture upside-down in Billboards

Post by mightypanda »

I think i found a bug in the Billboard object.
Textures loaded from any format show upside-down.

I think the problem is in the CBillboardSceneNode.cpp file.
In the class constructors the assignement of texture coordinates:

Code: Select all

	vertices[0].TCoords.set(0.0f, 0.0f);
	vertices[0].Color = 0xffffffff;

	vertices[1].TCoords.set(0.0f, 1.0f);
	vertices[1].Color = 0xffffffff;

	vertices[2].TCoords.set(1.0f, 1.0f);
	vertices[2].Color = 0xffffffff;

	vertices[3].TCoords.set(1.0f, 0.0f);
	vertices[3].Color = 0xffffffff;
Should be this way:

Code: Select all

vertices[0].TCoords.set(1.0f, 1.0f);
	vertices[0].Color = 0xffffffff;

	vertices[1].TCoords.set(1.0f, 0.0f);
	vertices[1].Color = 0xffffffff;

	vertices[2].TCoords.set(0.0f, 0.0f);
	vertices[2].Color = 0xffffffff;

	vertices[3].TCoords.set(0.0f, 1.0f);
	vertices[3].Color = 0xffffffff;
According to the index order makes more sense, and now works.
I hope it helps.

Stefano
Guest

Post by Guest »

0.0,0.0 1.0,0.0
-------------------------
- -
- -
- -
- -
- -
- -
- -
-------------------------
0.0,1.0 1.0,1.0



SEE:
http://nexe.gamedev.net/directKnowledge ... oordinates
mightypanda
Posts: 8
Joined: Wed Oct 06, 2004 2:04 pm
Location: Bologna, Italy
Contact:

Post by mightypanda »

Ok, but look right after in the CBillboardSceneNode::render() method.
vertices[0].Pos = pos + horizontal + vertical;
vertices[1].Pos = pos + horizontal - vertical;
vertices[2].Pos = pos - horizontal - vertical;
vertices[3].Pos = pos - horizontal + vertical;
vertices[0] is the bottom right, and vertices[2] is the top left.
That's the reason of the flip down, so also tex coord should be the opposite.
terefang
Posts: 48
Joined: Tue Jun 21, 2005 9:56 am

Post by terefang »

mightypanda wrote: vertices[0] is the bottom right, and vertices[2] is the top left.
That's the reason of the flip down, so also tex coord should be the opposite.
nope, i think rather the vertices should be fixed.
terefang
nVidia 7800GT/256, AMD64-X2 4k2, Latest Fedora/CentOS
Post Reply