Add a secondary texture coordinate to Vertex.

This commit is contained in:
Paul Chote
2016-04-10 12:46:31 -04:00
parent f07a5d6f69
commit 7c67b10d28
11 changed files with 59 additions and 47 deletions

View File

@@ -81,6 +81,8 @@ namespace OpenRA.Platforms.Default
OpenGL.CheckGLError();
OpenGL.glEnableVertexAttribArray(Shader.TexCoordAttributeIndex);
OpenGL.CheckGLError();
OpenGL.glEnableVertexAttribArray(Shader.TexMetadataAttributeIndex);
OpenGL.CheckGLError();
SDL.SDL_SetModState(SDL.SDL_Keymod.KMOD_NONE);
input = new Sdl2Input();

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Platforms.Default
{
public const int VertexPosAttributeIndex = 0;
public const int TexCoordAttributeIndex = 1;
public const int TexMetadataAttributeIndex = 2;
readonly Dictionary<string, int> samplers = new Dictionary<string, int>();
readonly Dictionary<int, ITexture> textures = new Dictionary<int, ITexture>();
@@ -73,7 +74,8 @@ namespace OpenRA.Platforms.Default
OpenGL.CheckGLError();
OpenGL.glBindAttribLocation(program, TexCoordAttributeIndex, "aVertexTexCoord");
OpenGL.CheckGLError();
OpenGL.glBindAttribLocation(program, TexMetadataAttributeIndex, "aVertexTexMetadata");
OpenGL.CheckGLError();
OpenGL.glAttachShader(program, vertexShader);
OpenGL.CheckGLError();
OpenGL.glAttachShader(program, fragmentShader);

View File

@@ -87,6 +87,8 @@ namespace OpenRA.Platforms.Default
OpenGL.CheckGLError();
OpenGL.glVertexAttribPointer(Shader.TexCoordAttributeIndex, 4, OpenGL.GL_FLOAT, false, VertexSize, new IntPtr(12));
OpenGL.CheckGLError();
OpenGL.glVertexAttribPointer(Shader.TexMetadataAttributeIndex, 2, OpenGL.GL_FLOAT, false, VertexSize, new IntPtr(28));
OpenGL.CheckGLError();
}
~VertexBuffer()