Original Post
Direct3D9: (WARN) :Can not render to a render target that is also used as a texture. A render target was detected as bound, but couldn't detect if texture was actually used in rendering.
Direct3D9: (WARN) :Can not render to a render target that is also used as a texture. A render target was detected as bound, but couldn't detect if texture was actually used in rendering.
D3DXCreateTexture(m_device, 512, 512, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_modDecals); m_modDecals->GetSurfaceLevel(0, &m_decalSurface); m_device->GetRenderTarget(0, &m_backbuffer); m_device->SetRenderTarget(0, m_decalSurface); m_device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); m_device->BeginScene(); m_sprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE); // Draw decal sprites. m_sprite->End(); m_device->EndScene(); m_device->SetRenderTarget(0, m_backbuffer);// Make sure the render target isn't still set as a source texturefor (int i=0; i< 16; i++) m_device->SetTexure(i, NULL);
Quote:
Original post by Adam_42
The warning is telling you that you have the render target set to draw from when you begin rendering to it. Having the same texture as both source and destination isn't valid so you get that warning. On the first frame the render to texture will work, it'll only cause that warning on the second and subsequent frames.
To fix it all you need to do is put something like the code below before you begin rendering to the target.// Make sure the render target isn't still set as a source texturefor (int i=0; i< 16; i++) m_device->SetTexure(i, NULL);
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more