Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Rendering front and back faces of a triangle(each face being diff)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 oreste   Members   -  Reputation: 149

Like
0Likes
Like

Posted 31 July 2014 - 02:52 PM

Windows 7 Dirext June 2010 VS 2013 Express Have a rotating triangle and am asked to chaNge code so that the back face of the triangle is rendered also. I achieve that using d3ddev-> SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) (d3ddev being a pointer to the drvice class LPDIRECT3DDEVICE9). The 3 vertices are defined each w/ a color (red, blue and green), on the back face i want only one color: white. How do i achieve this? Hints are welcome. I am a beginner, i.e. new to all this!!! Thanx Oreste

Sponsor:

#2 RoundPotato   Members   -  Reputation: 126

Like
0Likes
Like

Posted 31 July 2014 - 03:11 PM

You could simply set/change color value of those vertices to 255,255,255 (a.k.a. white) prior to drawing the back face. obviously remembering the original values before changing, and re-setting them back after back face has been rendered.

Edited by RoundPotato, 31 July 2014 - 03:12 PM.


#3 L. Spiro   Crossbones+   -  Reputation: 20869

Like
3Likes
Like

Posted 31 July 2014 - 03:13 PM

In the pixel shader, if input semantic VFACE is negative, use a white output color.

If you are not using shaders, use shaders.

 

Otherwise you have to draw it twice with different vertex colors.

 

 

L. Spiro


Edited by L. Spiro, 31 July 2014 - 03:14 PM.


#4 oreste   Members   -  Reputation: 149

Like
0Likes
Like

Posted 31 July 2014 - 04:26 PM

Shaders are coming up in my tutorial so i don't understand that aspect yet. But in both replies i read that i have to draw the triangle twice w/ diff colors and that's the rub (this is obviously exposing my ignorance in the matter). The vertices are defined w/ the CUSTOMVERTEX struct: CUSTOMVERTEX vertices[]= { {(3.0f, -3.0f, 0.0f, D3DCOLOR_XRGB(0, 0, 255)}, {...................................}, {............................... },} } Do i have to repeat this w/ the vertices defined in counter-clockwise order (and the color set to 255, 255, 255 AND modifying the size of the vertex buffer?? (clockwise order is the default in DirectX and has not been changed in the code).

#5 L. Spiro   Crossbones+   -  Reputation: 20869

Like
0Likes
Like

Posted 31 July 2014 - 06:47 PM

Do i have to repeat this w/ the vertices defined in counter-clockwise order (and the color set to 255, 255, 255 AND modifying the size of the vertex buffer?? (clockwise order is the default in DirectX and has not been changed in the code).

Yes.


L. Spiro

#6 oreste   Members   -  Reputation: 149

Like
0Likes
Like

Posted 31 July 2014 - 07:03 PM

Thanx got it!!!!!!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS