one vertex, two textures: how do I?

Started by
4 comments, last by d00fus 18 years, 3 months ago
I'm learning direct3d9, and i'm trying to make a "3ds view" application, that loads .3ds files and displays it. It's working fine now, I learned a lot, but today I got a very confusing doubt: Imagine you have: two faces, let's say face A (with texture 1 - large texture, high tiling) and face B (with texture 2 - no tiling); one vertex that belongs to the faces A and B; the flexible vertex format used is: struct Vertex { D3DXVECTOR3 position, normal; float u, v; //texture coordinates }; The question: how can the same vertex share the texture coordinates for the two faces to witch it belongs?
Advertisement
Unfortunately it can't; you will need to duplicate the vertex.
is there no way to do this without duplicating the vertex? I'm afraid duplicating the vertex can slow down the 3d engine.
I just realized there's another solution: take the vertex, set texture 1 active, draw, lock the vertex buffer, change the texture coordinates, unlock the buffer, set texture 2 active and draw again. What is better: this solution or duplicating the vertex???
I'd be very surprised if it had a performance impact - vertex processing is very seldom a bottleneck in most engines.
Duplicating the vertex will be at least an order of magnitude faster than that :)

This topic is closed to new replies.

Advertisement