Sign in to follow this  
rkshelton21

Render to Texture and Clamp/Wrap (Solved - Hardware Issue)

Recommended Posts

rkshelton21    122
I am trying to render a repeated texture that I draw to. If I use D3DXCreateTextureFromFile it works fine. (no render to texture) But when I use D3DXCreateTextureFromFileEx, and specify it as a render target, the texture no longer wraps. All my other textures wrap correctly but this one gets clamped. Is there something I am missing? [Edited by - rkshelton21 on May 5, 2009 11:23:42 AM]

Share this post


Link to post
Share on other sites
Jason Z    6434
The texture addressing mode is specified in your sampler description - it doesn't have anything to do with the creation of a texture/render target. Take a look at your sampler state and make sure you are setting the address modes appropriately like so (this syntax is from an effect file, but you can also do this programmatically):

AddressU = Wrap;
AddressV = Wrap;

Hope that helps.

Share this post


Link to post
Share on other sites
rkshelton21    122
Yeah, I already have.

SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );

And the wrapping works just fine as long as I don't set the texture as a render target. But as soon as I do, that particular texture gets clamped instead of wrapped.

Share this post


Link to post
Share on other sites
Jason Z    6434
Are you getting any messages from the D3D debug output? Perhaps you are binding the texture while it is still set as a render target?

Share this post


Link to post
Share on other sites
rkshelton21    122
Quote:
Original post by Jason Z
Are you getting any messages from the D3D debug output? Perhaps you are binding the texture while it is still set as a render target?


Nope, the output is fine. The texture even appears correctly with w/e I draw on it. Except that instead of repeating it is clamped after the first 0-1 tex coords.

Share this post


Link to post
Share on other sites
Jason Z    6434
Try to render the scene with the reference rasterizer to see if you have a driver bug or if you are doing something that isn't allowed. If it works with the reference rasterizer, it would probably be a driver implementation issue. If not, then for some reason you aren't supposed to be able to do a wrap interpolation mode.

Share this post


Link to post
Share on other sites
rkshelton21    122
Ok, using the ref rasterizer it works. Obviously really slow :) But, how do I find out what the device is lacking to perform this operation?

Also, thanks Jason!

Share this post


Link to post
Share on other sites
Jason Z    6434
What kind of hardware are you running on? If a laptop, then often there is not much luck in getting updated drivers. I have had similar issues that could only be corrected when Dell updated my driver to the latest level of Nvidia reference drivers.

Unfortunately, this problem is out of your hands... You could always try to report the issue. Perhaps the vendor has some work arounds that you could use. Good luck!

Share this post


Link to post
Share on other sites
rkshelton21    122
The one I was running it on was just a Radeon X1300 I ran it on another machine and it works just fine. Updated the drivers for the X1300 but still a bust.

Oh well, I'll just run it on the other machine. Any work around probably isn't worth the time for me to implement it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this