Jump to content
  • Advertisement
Sign in to follow this  
BigBeginner

D3DXCreateTexture and D3DUSAGE_RENDERTARGET error

This topic is 4846 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

Hi, I don't understand this error. I want to change the rendering's target, not to backbuffer but another texture. I read when I create an texture by D3DXCreateTexture function, I must to pass the D3DUSAGE_RENDERTARGET flag, like this: D3DXCreateTexture (Device, W,H, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, TEXTURE); But it returns with "invalid call". Loading texture by D3DXCreateTextureFromFileEx is correct, it accepts the D3DUSAGE_RENDERTARGET flag. What should I do?

Share this post


Link to post
Share on other sites
Advertisement
D3DUSAGE_RENDERTARGET can be only used with D3DPOOL_DEFAULT, so :

D3DXCreateTexture (Device, W,H, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, TEXTURE);

Share this post


Link to post
Share on other sites
Hi my Hungarian mate :)

Set MIP levels to 1 and pool to D3DPOOL_DEFAULT. A RenderTarget cannot be placed in Managed. (this is also written to the debug output if you switch on debug DX. do it if you didn't before, it's very useful)

kp

Share this post


Link to post
Share on other sites
Surely, the texture is created by this, but when I want to load into it an picture, the LockRect failed :( Invalidcall, because the textures that created by D3DPOOL_DEFAULT flag isn't be locked.

Share this post


Link to post
Share on other sites
And, another textureloading function is working:

D3DXCreateTextureFromFileEx (Device,
BLABLA.BMP),
0,
0,
0,
D3DUSAGE_RENDERTARGET,
D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT,
D3DX_FILTER_NONE,
D3DX_FILTER_NONE,
D3DCOLOR_ARGB( 255, 0, 0, 0 ),
nil,
nil,
Texture);

Share this post


Link to post
Share on other sites
hi,

now I have to ask:
what do you want to do with all this?

the only reason I can see for loadind a texture to a render target is that you want some background beforte rendering to the top of it. Am I right?
If so, then just use a screen0aligned quad, and render it with your background texture.
If not, then please clear us up, what do you want to see in the end?

kp

Share this post


Link to post
Share on other sites
Yes... but the target texture & used texture, X,Y positons, ALPHA colour can be variable. Whenever...

I must use the "D3DXCreateTexture" function not "D3DXCreateTextureFromFileEx" function, because my images are in an database in custom format, not in an external .BMP files.

Well, I loaded, showed, and "burned" textures that loaded by "D3DXCreateTextureFromFileEx" function... I can't see the reason, why works the D3DUSAGE_RENDERTARGET flag by "D3DXCreateTextureFromFileEx", and why not by "D3DXCreateTexture" function... :S

(napersze, ha az angolom miatt nem értesz, akkor priviben folytathatjuk ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by BigBeginner
Yes... but the target texture & used texture, X,Y positons, ALPHA colour can be variable. Whenever...


I dont understand what that means?

But what I think kovacsp was saying is, you should just render it to a quad(2 triangles) and then render it to the screen so thats all you see(screen aligned quad).

There is no need to push a texture to a target, set a target(like back buffer) and then render the quad to it. Generally you would keep it this way, meaning render whats on screen to a surface. You can change the values of u v coords whenever you like, or the alpha colors this way as well.

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!