Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Apply texture to two opposite sides of a quad. Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
langtudontinh

March 08, 2005, 02:52 AM

Work on Direct3D:

Hi everyone!
I have two textures and want to apply these into 2 sides of a quad. Could anyone show me the way?
Thank you.

ltdt.

 
Reedbeta

March 08, 2005, 03:03 AM

First, make sure back-face culling is enabled. Then make two separate quads: they will have the same vertex locations, but in the opposite order. Then you can apply two different textures to the quads, but they will look like one quad with two sides.

 
langtudontinh

March 08, 2005, 03:18 AM

m_pd3dDevice->SetRenderState(D3DRS_CULLMODE, xxx);

Should I xxx with D3DCULL_CW or D3DCULL_CCW?

 
Reedbeta

March 08, 2005, 04:35 AM

The usual convention is that counterclockwise (CCW) faces are forward-facing. So you want to cull clockwise (CW) faces.

 
Reedbeta

March 08, 2005, 04:37 AM

The usual convention is that counterclockwise (CCW) faces are forward-facing. So you want to cull clockwise (CW) faces.

 
langtudontinh

March 08, 2005, 09:04 PM

Thank you!

I have implemented and it works perfectly.

ltdt.

 
langtudontinh

March 08, 2005, 11:52 PM

There is another problem arises, How could I generate the opposite order vetices from a mesh?

 
Reedbeta

March 09, 2005, 01:37 AM

If your mesh is in the form of a triangle list or strip, you can just reverse the order of all vertices.

If it is a list of vertices and indices (i.e. DrawIndexedPrimitive) then reverse the order of indices.

 
langtudontinh

March 09, 2005, 01:58 AM

I use the mesh in the form of a triangle strip. I have just reversed the order of all vertices but the result is wrong (could not render the 2nd mesh).

 
langtudontinh

March 09, 2005, 10:29 PM

OK. I have fixed myself. I have some more question:
Could I apply 2 texture into 2 sides (by turning culling on) while tweening (morphing) from a quad into a cylinder???

 
Reedbeta

March 09, 2005, 11:30 PM

Yes, definetly.

 
langtudontinh

March 09, 2005, 11:58 PM



Reedbeta wrote: Yes, definetly.


Hi Reedbeta,
I Have turned backface culling on and did tweening from mesh A to mesh B. Culling just be ok at the state tween-factor = 0.0 (mesh A) and tween-factor = 1.0 (mesh B), but it's wrong while animation. PLS, show me how to fix the problem.

 
Reedbeta

March 10, 2005, 03:25 AM

I'll have to see some of your source code. Why don't you post the drawing function and the function to calculate tweened meshes?

 
langtudontinh

March 10, 2005, 04:25 AM



Reedbeta wrote: I'll have to see some of your source code. Why don't you post the drawing function and the function to calculate tweened meshes?


Thank you, I have fixed myself.

 
This thread contains 14 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.