fixed issue #475 (OpenGL3 RenderSystem SpriteBatch wrong colors)
This commit is contained in:
parent
57314d888a
commit
72f8e735fb
@ -190,6 +190,8 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
{
|
{
|
||||||
IsBound = true;
|
IsBound = true;
|
||||||
|
|
||||||
|
GL.Enable(EnableCap.Blend);
|
||||||
|
|
||||||
GL.BlendEquationSeparate(
|
GL.BlendEquationSeparate(
|
||||||
TranslateBlendFunction(ColorBlendFunction),
|
TranslateBlendFunction(ColorBlendFunction),
|
||||||
TranslateBlendFunction(AlphaBlendFunction));
|
TranslateBlendFunction(AlphaBlendFunction));
|
||||||
@ -245,14 +247,10 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
/// <param name="channels">Mask channels to enable.</param>
|
/// <param name="channels">Mask channels to enable.</param>
|
||||||
private void SetColorWriteChannel(int index, ColorWriteChannels channels)
|
private void SetColorWriteChannel(int index, ColorWriteChannels channels)
|
||||||
{
|
{
|
||||||
bool r = (channels == Graphics.ColorWriteChannels.All ||
|
bool r = (channels & Graphics.ColorWriteChannels.Red) == Graphics.ColorWriteChannels.Red;
|
||||||
channels == Graphics.ColorWriteChannels.Red);
|
bool g = (channels & Graphics.ColorWriteChannels.Green) == Graphics.ColorWriteChannels.Green;
|
||||||
bool g = (channels == Graphics.ColorWriteChannels.All ||
|
bool b = (channels & Graphics.ColorWriteChannels.Blue) == Graphics.ColorWriteChannels.Blue;
|
||||||
channels == Graphics.ColorWriteChannels.Green);
|
bool a = (channels & Graphics.ColorWriteChannels.Alpha) == Graphics.ColorWriteChannels.Alpha;
|
||||||
bool b = (channels == Graphics.ColorWriteChannels.All ||
|
|
||||||
channels == Graphics.ColorWriteChannels.Blue);
|
|
||||||
bool a = (channels == Graphics.ColorWriteChannels.All ||
|
|
||||||
channels == Graphics.ColorWriteChannels.Alpha);
|
|
||||||
|
|
||||||
GL.ColorMask(index, r, g, b, a);
|
GL.ColorMask(index, r, g, b, a);
|
||||||
ErrorHelper.Check("ColorMask");
|
ErrorHelper.Check("ColorMask");
|
||||||
@ -360,7 +358,6 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
{
|
{
|
||||||
switch (func)
|
switch (func)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
case BlendFunction.Add:
|
case BlendFunction.Add:
|
||||||
return BlendEquationMode.FuncAdd;
|
return BlendEquationMode.FuncAdd;
|
||||||
|
|
||||||
@ -376,6 +373,8 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
case BlendFunction.Max:
|
case BlendFunction.Max:
|
||||||
return BlendEquationMode.Max;
|
return BlendEquationMode.Max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new ArgumentException("don't know how to translate BlendFunction '" + func.ToString() + "' to BlendEquationMode");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.5.5.0")]
|
[assembly: AssemblyVersion("0.5.6.0")]
|
||||||
[assembly: AssemblyFileVersion("0.5.5.0")]
|
[assembly: AssemblyFileVersion("0.5.6.0")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
||||||
|
@ -147,7 +147,7 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data)
|
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data)
|
||||||
where T : struct
|
where T : struct
|
||||||
{
|
{
|
||||||
SetData<T>(graphicsDevice, data, 0, data.Length);
|
SetData<T>(graphicsDevice, 0, data, 0, data.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data,
|
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data,
|
||||||
|
@ -215,7 +215,7 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
GL.EnableVertexAttribArray(col);
|
GL.EnableVertexAttribArray(col);
|
||||||
ErrorHelper.Check("EnableVertexAttribArray col");
|
ErrorHelper.Check("EnableVertexAttribArray col");
|
||||||
GL.VertexAttribPointer(col, 4, VertexAttribPointerType.UnsignedByte,
|
GL.VertexAttribPointer(col, 4, VertexAttribPointerType.UnsignedByte,
|
||||||
false, vertexDeclaration.VertexStride, element.Offset);
|
true, vertexDeclaration.VertexStride, element.Offset);
|
||||||
ErrorHelper.Check("VertexAttribPointer col");
|
ErrorHelper.Check("VertexAttribPointer col");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -108,10 +108,17 @@ namespace WindowsGame1
|
|||||||
// Create a new SpriteBatch, which can be used to draw textures.
|
// Create a new SpriteBatch, which can be used to draw textures.
|
||||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||||
|
|
||||||
//this.texture = Content.Load<Texture2D>(@"Textures/DotColor4x4");
|
//this.alternateTexture = Content.Load<Texture2D>(@"Textures/DotColor4x4");
|
||||||
this.alternateTexture = Content.Load<Texture2D>(@"Textures/DotWhiteTopLeft5x5");
|
this.alternateTexture = Content.Load<Texture2D>(@"Textures/DotWhiteTopLeft5x5");
|
||||||
this.texture = Content.Load<Texture2D>(@"Textures/ANX.logo");
|
this.texture = Content.Load<Texture2D>(@"Textures/ANX.logo");
|
||||||
//this.texture = new Texture2D(GraphicsDevice, 64, 64);
|
|
||||||
|
//this.alternateTexture = new Texture2D(GraphicsDevice, 64, 64);
|
||||||
|
//Color[] color = new Color[this.alternateTexture.Width * this.alternateTexture.Height];
|
||||||
|
//for (int i = 0; i < color.Length; i++)
|
||||||
|
//{
|
||||||
|
// color[i] = new Color(1.0f, 1.0f, 0, 0.5f);
|
||||||
|
//}
|
||||||
|
//this.alternateTexture.SetData<Color>(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user