Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by madpower2000. 07/22/26 10:56
ZorroGPT
by TipmyPip. 07/21/26 17:54
New Zorro version 3.11
by jcl. 07/21/26 13:42
Lapsa's very own thread
by Lapsa. 07/18/26 13:40
Purchase A8 full licence version
by ukgamer. 07/17/26 05:52
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (TipmyPip, VoroneTZ, madpower2000), 1,548 guests, and 19 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: directx - render to surface [Re: jcl] #136299
06/15/07 16:19
06/15/07 16:19
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
hm... still doesn't work. the bitmap stays black. any ideas?



<edit>

it works now:

((LPDIRECT3DTEXTURE9)bmap_lightmap->d3dtex)->Release();
bmap_lightmap->d3dtex = pTargetTexture;
bmap_lightmap->flags |= (1<<15); // why do i need a () here in lite-c?
bmap_lightmap->flags &= ~(1<<27);

i found the reason only with visualc++ since it has much more helpful error messages. (left operand must be l-value!)

</edit>

Re: directx - render to surface [Re: ventilator] #136300
06/18/07 14:09
06/18/07 14:09
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
after i have rendered to the texture i would like to access individual pixels. unfortunately render targets can't be locked and unlocked.

any ideas how i could copy the content of the render target to a normal texture?

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 Offline OP
Senior Expert
ventilator  Offline 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: ventilator] #136302
06/27/07 04:15
06/27/07 04:15
Joined: Jul 2000
Posts: 28,126
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,126
Frankfurt
The difference is how you created the LPDIRECT3DTEXTURE9. I don't know what drawquad() does, but you can not, for instance, directly draw into render targets without creating them as lockable. The various restrictions of different types of textures are described in the DirectX manual.

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 Offline OP
Senior Expert
ventilator  Offline 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: ventilator] #136304
06/27/07 04:28
06/27/07 04:28
Joined: Jul 2000
Posts: 28,126
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,126
Frankfurt
If you want to render into a DirectX texture, you need to create it as render target. - For copying content between DirectX textures, use the LockRect() function to get a pointer on the content.

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 Offline OP
Senior Expert
ventilator  Offline 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>

Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1