|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| D3DXCreateTexture and D3DUSAGE_RENDERTARGET error |
|
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| 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? |
||||
|
||||
![]() Arex Member since: 7/1/2004 From: Helsinki, Finland |
||||
|
|
||||
| D3DUSAGE_RENDERTARGET can be only used with D3DPOOL_DEFAULT, so : D3DXCreateTexture (Device, W,H, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, TEXTURE); Sincerely, Arto Ruotsalainen Dawn Bringer 3D - Tips & Tricks |
||||
|
||||
![]() kovacsp Member since: 3/12/2004 From: Budapest, Hungary |
||||
|
|
||||
| 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 ------------------------------------------------------------ Neo, the Matrix should be 16-byte aligned for better performance! |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| 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. |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| 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); |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| Do somebody have got the D3DXCreateTextureFromFileEx function's source code? :)) |
||||
|
||||
![]() kovacsp Member since: 3/12/2004 From: Budapest, Hungary |
||||
|
|
||||
| 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 |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| 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 ;) |
||||
|
||||
![]() xsirxx Member since: 1/18/2004 From: Columbus, USA |
||||
|
|
||||
Quote: 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. |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| Hm, I forgot to mention an fact: I use ID3DXSprite interface to show textures. No vertexes, no quads... |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| And settled our differences: the LockRect method is used when I write into an empty texture, after "ID3DXCreateTexture". I don't want to "burn" an texture into another texture by "Lockrect", no! Before using "ID3DXSprite::Draw" method I use "SetRenderTarget" method, and after drawing, I set back the backbuffer. But the "SetRenderTarget" doesn't working except the texture is created by D3DUSAGE_RENDERTARGET method... it's ok... but, the texture that created like this, the "LockRect" method doesn't work... then, how to load an picture into this texture?? And how do the "D3DXCreateTextureFromFileEx" do it? |
||||
|
||||
![]() kovacsp Member since: 3/12/2004 From: Budapest, Hungary |
||||
|
|
||||
I think you can do anything with the ..Ex functions that you can do with the simple ones. You just have access to more parameters that are defaulted to some value in the simple versions, but you are still able to look them up and use (thus having the same effect).Quote: Well, try the two-big-triangles method then ;) There is no reason to stick to something that does not work for you. kp |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| I didn't say it doesn't works :)) |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| So are you telling me I should to use Direct3D vertexes and quads, not ID3DXsprite? |
||||
|
||||
![]() BigBeginner Member since: 8/2/2005 From: Szeged, Hungary |
||||
|
|
||||
| OK, I did everything with vertexbuffer-rectangles. I draw every texture by "Device.DrawPrimitive". So, how to set up to render to another texture, not to backbuffer? |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|