#### Archived

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

This topic is 5371 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
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 on other sites
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 on other sites
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.

1. 1
2. 2
Rutin
23
3. 3
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 11
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013158
×