Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Wrapping

Started by thelyingspy Sep 27, 2002 at 6:58 AM 0 replies 350+ views
Original Post
thelyingspy
thelyingspy
Hi, I''m trying to get Texture Wrapping going on a WinAmp Visualisation. I''ve done it before, and checked against a working app, but I can''t see why it isn''t going. From my render function...

	GetDevice()->SetRenderState(D3DRS_WRAP0, 0);
	GetDevice()->SetTextureStageState(0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP);
	GetDevice()->SetTextureStageState(0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP);
	GetDevice()->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
	GetDevice()->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
	
	GetDevice()->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);

	GetDevice()->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);

	D3DXMatrixIdentity( &matTT );
	matTT._31 = 0.0;
	matTT._32 = (jp.fYOffset / TEX_SIZE);

	GetDevice()->SetTransform(D3DTS_TEXTURE0, &matTT);

	GetDevice()->SetTexture(0, jp.tex);

	D3DXMatrixTranslation(&matWorld, 0.0, -0.5f, 3.5f);
	D3DXMatrixRotationYawPitchRoll(&matRotation, 0.0, 1.57, 0.0);
	D3DXMatrixScaling(&matScale, 1.0f, 1.0f, 1.0f);
	D3DXMatrixMultiply(&matWorld, &matScale, &matWorld);
	D3DXMatrixMultiply(&matWorld, &matRotation, &matWorld);
	GetDevice()->SetTransform( D3DTS_WORLD, &matWorld );
	GetDevice()->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 4, 0, 2);

 
Any texture outside 0.0 to 1.0 isn''t rendered. It looks like the texture wrap isn''t working. Please help, I''m on a tight schedule of an indefinate duration, TLS
thelyingspy
thelyingspy
OK, I''ve worked it out. It was that the texture size was not a pwer of 2.

Cheers

Topic Locked

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

Sign in to reply to this topic.