|
|
Re: directx - render to surface
[Re: ventilator]
#136301
06/25/07 00:37
06/25/07 00:37
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i tried to draw a textured quad to a texture. Code:
LPDIRECT3DTEXTURE9 pBackgroundTexture; D3DXCreateTextureFromFile(device, "test.tga", &pBackgroundTexture); ... device->SetTexture(0, pBackgroundTexture); drawquad();
why does this work? Code:
LPDIRECT3DTEXTURE9 pBackgroundTexture = (LPDIRECT3DTEXTURE9)bmap_background->d3dtex; ... device->SetTexture(0, pBackgroundTexture); drawquad();
why does this not work?
|
|
|
Re: directx - render to surface
[Re: jcl]
#136303
06/27/07 04:20
06/27/07 04:20
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
Code:
void drawquad() { device->SetFVF(TEXTUREDVERTEXFVF); TEXTUREDVERTEX v[4];
v[0].x = 0; v[0].y = 0; v[0].z = 0; v[0].u = 0; v[0].v = 0; v[1].x = 512; v[1].y = 0; v[1].z = 0; v[1].u = 1; v[1].v = 0; v[2].x = 512; v[2].y = 512; v[2].z = 0; v[2].u = 1; v[2].v = 1; v[3].x = 0; v[3].y = 512; v[3].z = 0; v[3].u = 0; v[3].v = 1; device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, (LPVOID)v, sizeof(TEXTUREDVERTEX)); }
the texture i created myself works. the texture of the 3dgs bitmap doesn't work. isn't the texture of a 3dgs bitmap lockable? ... do you also have some suggestion regarding my other question? can i copy content from a render target to a lockable texture somehow?
|
|
|
Re: directx - render to surface
[Re: jcl]
#136305
06/27/07 04:37
06/27/07 04:37
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
yes, i have a working render target. that was what the thread originally was about and thanks to your help that problem seems to be solved. now i simply would like to render some textured geometry but a 3dgs bitmap->d3dtex doesn't work if i set it to be the texture. the drawn geometry stays black then. it works with a directx texture i created myself though! Quote:
For copying a content between DirectX textures, use the LockRect() function to get a pointer on the content.
i would like to copy from a render target to a normal texture. since a render target is in D3DPOOL_DEFAULT it is not lockable according to the directx manual. is there some trick to copy something nevertheless?
<edit> i just came across IDirect3DDevice9::GetRenderTargetData which i didn't notice before and will try that! </edit>
|
|
|
|