texture to surface

Started by
15 comments, last by kain0015 18 years, 3 months ago
Quote:Original post by devronious
I had a similar problem if I remember correctly. And I think it was with A8R8G8B8 format too. I had to set the texture size symmetric, ie w = h. I was trying to set my texture to 156x48 and it was dynamic too (size would be different from time to time).


Yeah, thats my problem too. I guess thats the problem why it doesnt work. I'll try to make them symmetric.

Edit: Well, when I make them symmetric I have to rewrite a lot of the code... my textures only rotate only 90°. There have to be another solution *G*

[Edited by - kain0015 on January 4, 2006 5:09:55 AM]
Advertisement
Notice in my last post that I didn't have to make them symmetric. That's becaused I moved away from other surface types and created two textures instead. Change from offplainsurface to a normal texture that has the rendertarget argument. But make sure that they both have the rendertarget argument set.

You should be able to set one of the textures surfaces to the device rendertarget, ie: device.SetRenderTarget(0, texture.GetSurfaceLevel(0));

[edit] prob should be more clear. Set Usage.RenderTarget when creating the textures.

[Edited by - devronious on January 4, 2006 9:23:23 AM]
In you code, what is m_lpGameField? What do you want to do? Maybe StretchRect is not the method you need as it may stall your game. Maybe rendering the section as a sprite into other texture can do the job faster.

Luck!
Guimo


Guimo,

Is there a way to use the same render matrices, use the same render target width and height as the normal scene, but use a smaller target that represents a rectangle in the original render area? Perhaps some sort of clipping region or such?

Thanks,

Devin
Quote:Original post by devronious
Notice in my last post that I didn't have to make them symmetric. That's becaused I moved away from other surface types and created two textures instead. Change from offplainsurface to a normal texture that has the rendertarget argument. But make sure that they both have the rendertarget argument set.

You should be able to set one of the textures surfaces to the device rendertarget, ie: device.SetRenderTarget(0, texture.GetSurfaceLevel(0));

[edit] prob should be more clear. Set Usage.RenderTarget when creating the textures.


Hmm... so you copy the stuff from the source texture to another (target)texture instead of a surface. Then you copied the (target)texture into the target-surface? Sorry if I didnt get you right
Actually maybe this is wrong way for you. I rendered an object to a texture that was the same size as my screen so that I could get a duplicate of how it would render in the scene. Then copied the item from that texture to a texture that was only the size of the object image I wanted (which it's size was dynamic). From there I paint multiple copies of it into my scene via a sprite.


I could cut out a step by rendering directly to my smaller texture, but I currently don't know how and don't want to take the time to figure it out on my own. I've found that every problem has a solution it's just a matter of how long to figure it out.

-Devin
I dont get it... if I dont rotate anything, just drawing the texture to the surface, it dont work.
But:
I dont changed the code, just got the things to add into the surface from a file (png) and it works. I used a graphic that is 52*52, i took the texturesize, etc. from the texture-object, but if I use GetSurfaceLevel it doesent work. If i load it from a file, it works.
I dont changed anything on the code!! I just replaced GetSurfaceLevel with D3DXLoadSurfaceFromFile.
The problem is that i cant rotate surfaces...

This topic is closed to new replies.

Advertisement