Skip to main content
gamedev.net
🔒 Locked

D3DXLoadSurfaceFromSurface problem

Started by GerardL Sep 2, 2008 at 9:15 AM 4 replies 1.4k views
Original Post
GerardL
GerardL
Hello, I'm trying to copy parts of a texture to a new texture. This works perfectly with uncompressed textures, also when copying the entire source texture it works, but when using compressed textures it fails. The function call that is used is: hr = D3DXLoadSurfaceFromSurface( destSurface, NULL, NULL, sourceSurface, NULL, &rectangle, D3DX_DEFAULT, 0 ); By default the destination texture is made using the same format as the source texture, but also when the destination texture is uncompressed it fails. It doesn't give an error, but most of the time the result is an empty texture, sometimes (when specifying a rectangle of which right and bottom are larger then half the size) is does copy something, but it just doesn't make sense. Any suggestion would be welcome.
maxest
maxest
It's a long shot - try StretchRect
GerardL
GerardL
Never mind, after looking for hours for the problem, I figured it out 5 minutes after this post...figures

Tnx anyway for the responce
Evil Steve
Evil Steve
What do the Debug Runtimes say? The docs say: "This function handles conversion to and from compressed texture formats.", so there's no reason it shouldn't work. Are you checking that the return value is SUCCEEDED()?
maxest
maxest
Quote:

Never mind, after looking for hours for the problem, I figured it out 5 minutes after this post...figures

One little request. If you find the solution for your problem please, share it with us. Maybe someone else will have similar problem and could find the solution here. It would be great to know if your problem was connected with D3DXLoadSurfaceFromSurface or maybe you're messing up in some totally different place?
GerardL
GerardL
The solution was totally unrelated to what I initially thought the problem was.
The UV coordinates that were exported, weren't correctly converted. So it looked like the function D3DXLoadSurfaceFromSurface didn't work correctly. While it worked perfectly, but somewhere else I simply displayed a mesh with the wrong UV coordinates.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.