Use explicit shader attributes.

This commit is contained in:
Paul Chote
2015-12-19 23:57:52 +00:00
parent 788def1c31
commit be29ec5342
11 changed files with 64 additions and 38 deletions

View File

@@ -18,6 +18,9 @@ namespace OpenRA.Platforms.Default
{
class Shader : ThreadAffine, IShader
{
public const int VertexPosAttributeIndex = 0;
public const int TexCoordAttributeIndex = 1;
readonly Dictionary<string, int> samplers = new Dictionary<string, int>();
readonly Dictionary<int, ITexture> textures = new Dictionary<int, ITexture>();
readonly int program;
@@ -62,6 +65,12 @@ namespace OpenRA.Platforms.Default
// Assemble program
program = GL.CreateProgram();
ErrorHandler.CheckGlError();
GL.BindAttribLocation(program, VertexPosAttributeIndex, "aVertexPosition");
ErrorHandler.CheckGlError();
GL.BindAttribLocation(program, TexCoordAttributeIndex, "aVertexTexCoord");
ErrorHandler.CheckGlError();
GL.AttachShader(program, vertexShader);
ErrorHandler.CheckGlError();
GL.AttachShader(program, fragmentShader);