Original Post
🔒 Locked
Wrapping Textures Problem
Advertisement
pDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );pDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
Actually i mean Textureadressing
I set these renderstates and samplerstates directly after creating the D3D-Device:
i use a quad where i want the texture to be wrapped. My Renderfunction for this quad looks like this:
All works well for none wrapped textures (texcoords between 0.0 and 1.0). Setting the coords to different values, nothing is rendered (no error message too).
I set these renderstates and samplerstates directly after creating the D3D-Device:
g_d3d_Device->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);g_d3d_Device->SetRenderState(D3DRS_ZENABLE, TRUE);g_d3d_Device->SetRenderState(D3DRS_LIGHTING, TRUE);g_d3d_Device->SetRenderState(D3DRS_SPECULARENABLE, TRUE);g_d3d_Device->SetRenderState(D3DRS_DITHERENABLE, TRUE);g_d3d_Device->SetRenderState(D3DRS_WRAP0, 0);g_d3d_Device->SetSamplerState0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);g_d3d_Device->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);g_d3d_Device->SetSamplerState(1,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);g_d3d_Device->SetSamplerState(1,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);g_d3d_Device->SetSamplerState(0,D3DSAMP_ADDRESSU,D3DTADDRESS_WRAP); g_d3d_Device->SetSamplerState(0,D3DSAMP_ADDRESSV,D3DTADDRESS_WRAP);g_d3d_Device->SetTextureStageState(0,D3DTSS_TEXCOORDINDEX,0);g_d3d_Device->SetTextureStageState(1,D3DTSS_TEXCOORDINDEX,0);g_d3d_Device->SetRenderState( D3DRS_AMBIENT, 0xffffffff );i use a quad where i want the texture to be wrapped. My Renderfunction for this quad looks like this:
g_d3d_Device->SetRenderState(D3DRS_ZENABLE, FALSE); g_d3d_Device->SetRenderState(D3DRS_LIGHTING, FALSE); g_d3d_Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);g_d3d_Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);g_d3d_Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);g_d3d_Device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); g_d3d_Device->SetTexture(0,pTex->GetTexture());g_d3d_Device->SetStreamSource(0, SpriteVB, 0, sizeof(GUI_SCREENVERTEX));g_d3d_Device->SetFVF(D3DFVF_GUI_SCREENVERTEX);g_d3d_Device->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); g_d3d_Device->SetTexture(0,NULL);g_d3d_Device->SetRenderState(D3DRS_LIGHTING, TRUE);g_d3d_Device->SetRenderState(D3DRS_ZENABLE, TRUE);All works well for none wrapped textures (texcoords between 0.0 and 1.0). Setting the coords to different values, nothing is rendered (no error message too).
Have you tried setting those stage states after the SetTexture() call? I don't recall offhand whether those get reset by that call.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement