Archived

This topic is now archived and is closed to further replies.

dave

Please Help me with this matrices problem!

Recommended Posts

dave    2187
I''m trying to create a cube the i can resize in the x,y and z dimensions and apply an individual texture and material to each face. The problem is that i have created each face in a separate vertex buffer because i couldnt think of any other way that i could apply the different textures, other than the shaders but thats very tricky. When it comes to rotating them they dont rotate properly i created each panel as a mesh and the rotation axis is always the bottomleft panel. hope this is clear please help ACE

Share this post


Link to post
Share on other sites
tok_junior    229
You REALLY shouldn''t use a separate vertexbuffer for each face of the cube, since switching buffers isn''t a very speedy operation, even with todays cards and drivers.
Stick them in the same buffer, but just draw the tri''s you''re currently using.

Share this post


Link to post
Share on other sites
dave    2187
so once i have locked a vertex buffer, is it possible to unlock it and read out the vertices i wrote in earlier, if i did this how could i distinguish the vertices for one of the faces from the others.

Also how can i change the rotation axis of an object, the (0,0) vertex of the panel is bottom left but it wouldbe better in the middle.

Any ideas?

Share this post


Link to post
Share on other sites
Lab-Rat    270
The vertex buffer can be locked and then the vertices read back out. But you probably don''t need to do that since all the verticies will always remain in the same order. For example using a triangle list for the cube will have the first face in the first six vertices, the second in the next six and so on.

Matrices are non-commutive, ie the order they are applied has an effect. This also means that you can apply the same type of transformation at different points to achive different effects. To rotate your cube about its center you could simply apply a translation to center the cube. Then apply your rotaion and have it rotate about its center as required. Then apply a second translation to place it within the correct position in your scene. Another rotation applied at this point would orbit the cube around the world origin, a similar effect to that of rotating the cube while it is not centered.

Share this post


Link to post
Share on other sites