Jump to content
  • Advertisement
Sign in to follow this  
tupeltaja

[SlimDX] Surface not properly drawn with transparency

This topic is 2775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Morning all,

I draw to a separate Surface with ordinary methods (which will draw transparency properly if not using surface). When using the surface as render target, there is no transparency in the result. Otherwise it seems good. Can't tell whether this is due drawing to this surface or drawing the surface to buffer.

So I'm doing something wrong. Any hints?

Here are the related code snippets:

Creation of target surface (buffer to draw to)

Surface surfaceCurrent = m_dxDevice.GetRenderTarget(0);

SurfaceDescription desc = surfaceCurrent.Description;

m_surface = Surface.CreateRenderTarget(
m_dxDevice,
m_iClientSizeW,
m_iClientSizeH,
Format.A8R8G8B8,
desc.MultisampleType,
desc.MultisampleQuality,
false);

m_rd.m_dxDevice.SetRenderTarget(0, m_surface);

m_rd.m_dxDevice.Clear(ClearFlags.All, 0xffffff, 0, 0);
// draw as usual
...
// restore render target
m_dxDevice.SetRenderTarget(0, surfaceCurrent);


Render to buffer:


// get buffer
Surface buffer = m_dxDevice.GetBackBuffer(0, 0);

// draw to buffer
m_dxDevice.StretchRectangle(
m_surface,
drawRect,
buffer,
drawRect,
TextureFilter.None);

Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!