Create texture from surface.

Started by
4 comments, last by Abob 21 years, 1 month ago
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
Arrg!!
Advertisement
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.

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.
Arrg!!
^
Arrg!!
Up
Arrg!!
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.

This topic is closed to new replies.

Advertisement