• Create Account

Such1

Member Since 08 May 2012
Offline Last Active Dec 22 2013 12:07 PM

In Topic: (Solved)Render 3D Triangle List

07 January 2013 - 11:20 PM

try switching vertices 1 and 2 to see if the triangle isn't facing the other way.

In Topic: Simulating CRT persistence?

03 December 2012 - 07:45 PM

Why do you have this? float blendFactors[] = {.99, .97, .9, 0};
shouldn't it be something like:
float blendFactors[] = {.9, .9, .9, .9};
And no, it will never fade completely(theoretically), but it should get really close.

In Topic: How would I get 3D co-ordinates from cursor position?

03 December 2012 - 01:02 AM

I assume you already have the camera position, which I'll call m_cameraPosition.
this returns the mouse direction in 3D:
```POINT mp = getMousePosition();
D3DXVECTOR3 v;
v.x =  ( ( ( 2.0f * mp.x ) / m_width ) - 1 ) / m_perspectiveProjection._11;
v.y = -( ( ( 2.0f * mp.y ) / m_height ) - 1 ) / m_perspectiveProjection._22;
v.z =  1.0f;
D3DXMATRIX m;
D3DXVECTOR3 rayDir;
D3DXMatrixInverse( &m, NULL, &getCameraMatrix() );
// Transform the screen space pick ray into 3D space
rayDir.x  = v.x*m._11 + v.y*m._21 + v.z*m._31;
rayDir.y  = v.x*m._12 + v.y*m._22 + v.z*m._32;
rayDir.z  = v.x*m._13 + v.y*m._23 + v.z*m._33;
return rayDir;
```
.
getCameraMatrix() returns the camera view matrix
m_perspectiveProjection is the projection matrix
m_width and m_height are the size of the screen
getMousePosition() returns the client mouse position

so the final position would be:
rayDir * distance + m_cameraPosition;

change distance as you desire, or calculate it if you need that z = 50

In Topic: Simulating CRT persistence?

02 December 2012 - 08:33 PM

You have 2 backBuffer, you should do something like this:
clean both buffers
loop:
render buffer1 on buffer2 with 90%
clean buffer1
render what you want on buffer 2
switch places between buffer 1 and 2
your image is now on buffer1

In Topic: Simulating CRT persistence?

02 December 2012 - 05:33 PM

I think you are not clearing the buffers after u used them.

PARTNERS