Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
use gamma correction

 

No!

 

The Gamma functions are very poorly supported in drivers. Just use a quad. It's very fast and efficient. You can also do much cooler effects than you can with Gamma. And it works on anything.

Posted

Hey,

 

Thank you all guys... as i understood correctly..

I'm building a black full screen texture and paste it over the current screen playing with it's alpha value.

 

I haven't tried it yet - but it should work.

 

Thanks.

Posted
You can save memory by skipping the texture. Just use a quad (2 triangles) and set their diffuse colour to black. Fiddle with the alpha and you're set.

 

Pardon me for asking, but how do i do that. I mean creating the traingles. Untill now i used only Textures and Surfaces with the Sprite class or UpdateSurface. :-\

 

I have the Device3D, and i have the back buffer surface.

 

Thanks, LDV.

Posted
Create a VertexBuffer, an array of vertices. Fill the vertices with data and set data to the VertexBuffer. Check the documentation. Although it's scarce I think there's a howto about this.
Posted

More problems ...

 

Ok, Guys, Thanks i did it.

 

But there is still a problem.

If i draw somethings uding .UpdateSurface or .StrechRectangle the quad shows transpernet on them. - that's OK.

But if i draw something using the Sprite object (Yes - with Alpha flags) it draw over the Quad, and i can not see the transpernt quad.

 

Maybe it's something for the order i do the:

m_sprite.Begin(SpriteFlags.AlphaBlend);??

 

Or maybe it's something using the .Z property??

 

Here is some code:

The Vertex:

m_device.RenderState.CullMode = Cull.None;

m_device.VertexFormat = CustomVertex.PositionColored.Format;

 

m_vertexFade = new VertexBuffer(typeof(CustomVertex.PositionColored), 6, m_device, 0, CustomVertex.PositionColored.Format, Pool.Default);

CustomVertex.PositionColored[] fverts = (CustomVertex.PositionColored[]) m_vertexFade.Lock(0, 0);

fverts[0] = new CustomVertex.PositionColored(0, 0, 1, m_clrFade.ToArgb());

fverts[1] = new CustomVertex.PositionColored(0, 768, 1, m_clrFade.ToArgb());

fverts[2] = new CustomVertex.PositionColored(1024, 768, 1, m_clrFade.ToArgb());

 

fverts[3] = new CustomVertex.PositionColored(0, 0, 1, m_clrFade.ToArgb());

fverts[4] = new CustomVertex.PositionColored(1024, 0, 1, m_clrFade.ToArgb());

fverts[5] = new CustomVertex.PositionColored(1024, 768, 1, m_clrFade.ToArgb());

m_vertexFade.Unlock();

 

The drawing of the obeject with Sprite object:

sprite.Draw(m_texture, m_rect[num], new Vector3(0, 0, 0), new Vector3(x, y, 0.5F), Color.FromArgb(255, 255, 255, 255));

 

Thank you all in advance, LDV

Posted

First, DrunkenHyana i want to thank you for your truely help.

 

I tried to set them all Z to 0, and i checked i draw the Preimitve after i draw the Sprite and it didn't help.

 

I found another thing that was the problem.

 

I called Sprite.Flush() before i draw the primetives - that made it almost ok.

 

There are two new problems now:

1. Somehow i don't get the full fae out now, i set it all to Alpha-255,RGB 0,0,0 and still it looks darker but now totally black - before - it was all black, except for the Sprite object ofcousre.

2. The program is much slower now.

 

Thanks, LDV

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...