Skip to main content
gamedev.net
🔒 Locked

Simple Silly Problem

Started by dachande Jan 20, 2005 at 2:57 PM 6 replies 650+ views
Original Post
dachande
dachande
Hi all, I'm having some weird issues with SetTransform - it appears to be having no effect! I have an empty shell of an application (test app), with this as the render loop:

	D3DXMATRIX out;
	D3DXVECTOR3 eye(20000,30000,30000);
	D3DXVECTOR3 at(0,0,0);
	D3DXVECTOR3 up(0,1,0);
	D3DXMatrixLookAtLH(&out, &eye, &at, &up);

	//Set the "Camera"
	pD3DDevice->SetTransform(D3DTS_VIEW, &out)

	pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0);

	if( SUCCEEDED(pD3DDevice->BeginScene()))
	{
		//Draw a triangle to see if our view has changed...
		pD3DDevice->SetStreamSource( 0, pVBuff, 0, sizeof(CUSTOMVERTEX) );
		pD3DDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
		pD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );

		pD3DDevice->EndScene();
	}

	//Present the scene to the display
	pD3DDevice->Present(NULL, NULL, NULL, NULL);

Whatever I enter in to my view matrix, I get the same thing on the screen, a triangle in the top left quarter. This is the same result if I miss out the SetTransform line all together! Comparing my code to that of anothers, I see no significant differences.. any ideas why this might be screwing up? Help would be apreciated, Thanks, Dachande
Mezz
Mezz
What about your other "Transform" matrices (projection, world)? And what vertices are in your vertex buffer. I assume you've tried it with values that aren't as whacked out as 20000, 30000, 30000 for the eye position?

-Mezz
dachande
dachande
Hey,

The world matrix is left alone, the projection matrix is set up before hand as follows:

(This code is called just before the render loop starts)

D3DXMATRIXA16 matrix;D3DXMatrixPerspectiveFovLH(&matrix, DegreesToRadians(60), ((float)iWinWidth / (float)iWinHeight), 1.0f, 8192.0f);pD3DDevice->SetTransform(D3DTS_PROJECTION, &matrix);


To be safe, I've used the same figures as in the working example I've been reviewing. That example also leaves the world matrix alone.

The 2000, 3000, 3000 were a last desperate effort to get results!

Any ideas?

Dachande

[Edited by - dachande on January 20, 2005 5:21:18 PM]
dachande
dachande
Still having no luck with this - but I have used GetTransform() to confirm that my changes are taking place. I'm getting back the same matrices that I'm sending to SetTransform(), so my changes have "worked" only they are not making ANY difference to the render!!?!

Help!
Mezz
Mezz
Hmmm... OK if your test app is small and you're not bothered about giving it out, then zip it up and give me a link to it and I'll try to debug it later today (include source). I can't figure out what is going on from that snippet at the minute.

Regards,

-Mezz
PetrusRex
PetrusRex
Maybe the problem is that you are using pre-transformed vertex, so the the transforms are not being applied to them. Check if this is the case, or post here the FVF you are using.

Mezz
Mezz
Quote:
Original post by PetrusRex
Maybe the problem is that you are using pre-transformed vertex, so the the transforms are not being applied to them. Check if this is the case, or post here the FVF you are using.


The man has a point :)
dachande
dachande
The man has an exceedingly good point :)

As suspected, a very silly (solved) problem.

To be honest, I don't feel as stupid now as perhaps I should! It didn't occur to me that there might be a transformed FVF, after having only glazed over the FVF docs.

Thanks PetrusRex! Thanks for your suggestions Mezz :)

Dachande

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.