Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I'm attempting to convert my UI code that is successfully using TransformedTextured to code that uses PositionTextured so that my imagry changes size to fit when resolution is changed.

 

From my understanding I simply need to set my view and world matrices to Identity and then setup my projection matrix to fit the screen.. I've put together a little test app that does it as such.

 

device.Transform.World = Matrix.Identity;

device.Transform.View = Matrix.Identity;

device.Transform.Projection = Matrix.OrthoOffCenterLH(0, 640, 480, 0, 0, 1);

 

However I'm not getting the results I expect.

 

Does anyone have any ideas?

 

(I've attached the complete source to my test)

form1.cs

Edited by Slade
Posted

I've actually narrowed it down to a problem with alpha

 

// These two lines cause the code to render nothing

device.RenderState.SourceBlend = Blend.SourceAlpha;

device.RenderState.DestinationBlend = Blend.InvSourceAlpha;

 

// These two lines cause it to work.

device.RenderState.SourceBlend = Blend.One;

device.RenderState.DestinationBlend = Blend.Zero;

 

this kills the alpha blending however :/

 

I guess now I'm lost on why this works as I'd like it to with transformed vertices, but not with position ones.

Posted

i dont know... but u can go and pretend stupid (like me) and do this

 

- dont change the SourceBlend nor the DestinationBlend properties

- use color keying when painting the images (this keeps the alpha values).

Menge

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...