UV Coordinate Issue

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

UV Coordinate Issue

Post by webjeff »

is there anything special with GU_TEXTURE_32BITF, whenever I add that and add UV's my model looks all weird.

My vertex buffer contains (in this order)
UVs 2 floats (8 bytes)
VERTS 3 floats (12 bytes)

Everything renders fine without UV's added, but then its all white, but when I add the GU_TEXTURE_32BITF and add my uv's to the vertex buffer weird stuff happens. Am I missing something obvious?


I am calling drawarray like this:

sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_INDEX_16BIT|GU_TRANSFORM_3D,count,&m_PSPIndexBuffer[0],&m_PSPBuffer[0]);

Thanks alot
Jeff
71M
Posts: 122
Joined: Tue Jun 21, 2005 5:28 am
Location: London

Re: UV Coordinate Issue

Post by 71M »

webjeff wrote:is there anything special with GU_TEXTURE_32BITF, whenever I add that and add UV's my model looks all weird.

My vertex buffer contains (in this order)
UVs 2 floats (8 bytes)
VERTS 3 floats (12 bytes)

Everything renders fine without UV's added, but then its all white, but when I add the GU_TEXTURE_32BITF and add my uv's to the vertex buffer weird stuff happens. Am I missing something obvious?


I am calling drawarray like this:

sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_INDEX_16BIT|GU_TRANSFORM_3D,count,&m_PSPIndexBuffer[0],&m_PSPBuffer[0]);

Thanks alot
Jeff
Have you tried padding your vertex structure to 32 bytes?
This is written in the docs next to the definition of sceGuDrawArray -
"NOTE: Every vertex must align to 32 bits, which means that you HAVE to pad if it does not add up!"

Hope that solves your problem...

71M
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

bits != bytes.

And if he's already using floats for everything, it's already aligned. It's when you start using the 8- and 16-bit types you have to deal with it.

And it's nothing special about the uv-coordinates, except perhaps that without them, you might see some kind of result, and with them in the vertex-buffer, you get proper coordinates, but you've setup the parameters incorrectly? Look at the samples, there are a few that uses textures, it shouldn't be too complex to find your error.
GE Dominator
Post Reply