Archived

This topic is now archived and is closed to further replies.

Abob

Create texture from surface.

Recommended Posts

Abob    122
I am trying to copy from a DirectX 8 surface to a DirectX 8 texture. The way I am doing it: Create a new texture. Get the surface of the texture with GetSurfaceLevel. Copy from the source surface to the texture surface with CopyRects Release texture surface. When I draw the texture (with ID3DXSprite) it dos not draw. The draw call dos not fail but nothing is drawn to the screen. I know that the image is being copied over to the texture surface because if I save the texture surface to a file with D3DXSaveSurfaceToFile The image shows up in the file. I have read through this thread on the topic and I think that I am doing every thing right so I do not know why it is not working for me. I don’t thing that this should be a problem but I am creating the texture in the D3DPOOL_MANAGED pool. Thanks for any help

Share this post


Link to post
Share on other sites
Osc    122
Could it be a mipmapping problem (lower LODs of your texture not being set)?

Just to help in tracking down your bug...

You have a piece of code that creates a texutre and copies an existing surface into this textures top level surface. Try replacing *just this bit* with something that loads a texture from a file, and see if everything else magically works with this other texture.

Share this post


Link to post
Share on other sites
Abob    122

quote:

Could it be a mipmapping problem (lower LODs of your texture not being set)?



I am creating the texture with only 1 level so I do not think that is the problem.



If I Create the texture from a file with
D3DXCreateTextureFromFileEx
It draw fine.

Share this post


Link to post
Share on other sites
Osc    122
Okay... Are you using D3DRS_ALPHATESTENABLE or D3DRS_ALPHABLENDENABLE?

If so, it''s possible that your texture alpha channel is all-zeros. Try disabling these states and see if it makes a difference.

Share this post


Link to post
Share on other sites