Jump to content
  • Advertisement
Sign in to follow this  
aprilspirit89

Got problem with CreateTexture

This topic is 2355 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The return value is FFFFFFFF 8876086C.I tried to change parameters but it didn't work.But I Succeed in CreateOffscreenPlainSurface.Can somebody tell me the reason?

Share this post


Link to post
Share on other sites
Advertisement
Most probably some parameters are wrong ? Maybe trying to create a texture in a not supported format ?

It could help when you post some more code....

Share this post


Link to post
Share on other sites

Most probably some parameters are wrong ? Maybe trying to create a texture in a not supported format ?

It could help when you post some more code....

Thank you for your reply.It's just a simple render-to-texture function.I used D3DFMT_A8B8G8R8,D3DFMT_A16B16G16R16,D3DFMT_R8G8B8,etc.//And actually these code worked well yesterday...

LPDIRECT3DTEXTURE9 pRenderTexture=NULL;
LPDIRECT3DSURFACE9 pRenderSurface=NULL,pBackBuffer=NULL;

HRESULT hr=g_pd3dDevice->CreateTexture(Width,Height,1,D3DUSAGE_RENDERTARGET,D3DFMT_A8B8G8R8,D3DPOOL_SCRATCH,&pRenderTexture,NULL);
pRenderTexture->GetSurfaceLevel(0,&pRenderSurface);

g_pd3dDevice->GetRenderTarget(0,&pBackBuffer);
g_pd3dDevice->SetRenderTarget(0,pRenderSurface);
g_pd3dDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DXCOLOR(0,0,0,1),1.0f,0);

Render(0,NULL);

g_pd3dDevice->SetRenderTarget(0,pBackBuffer);
D3DXSaveTextureToFile(pTexFileName,destFormat,pRenderTexture,NULL);

pBackBuffer->Release();

SAFE_RELEASE(pRenderSurface);
SAFE_RELEASE(pRenderTexture);
return S_OK;
[/quote] Edited by Tunisia hawker

Share this post


Link to post
Share on other sites
You can't create a render target in D3DPOOL_SCRATCH. From the documentation (for the D3DUSAGE enum):

The resource will be a render target. D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT.[/quote]

Share this post


Link to post
Share on other sites

You can't create a render target in D3DPOOL_SCRATCH. From the documentation (for the D3DUSAGE enum):

The resource will be a render target. D3DUSAGE_RENDERTARGET can only be used with D3DPOOL_DEFAULT.

[/quote]
Right.Thank you ! I've fixed that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!