Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

SamplerStates and Setting a Texture

$
0
0

@skyemaidstone wrote:

I realised that adjusting the sampler states using:

sampler ShadowMapSampler = sampler_state
{
    Texture = <ShadowMap>;
	minfilter = point;
	magfilter = point;
	mipfilter = point;
};

Doesn't seem to do anything in MonoGame.

So I used (in the C# code):

    var pointsampler = new SamplerState
    {
        AddressU = TextureAddressMode.Wrap,
        AddressV = TextureAddressMode.Wrap,
        AddressW = TextureAddressMode.Wrap,
        Filter = TextureFilter.Point,
         
    };

    GraphicsDevice.SamplerStates[0] = linearsampler;

And in the HLSL:

sampler ShadowMapSampler : register(s0);

My question is: How do I set the texture part like I used to?

I would have been able to just sample using:

distanceStoredInDepthMap = tex2D(ShadowMapSampler, lightSamplePos);

But I can't because there's no texture set in the sampler.

I'm confused.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles