2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

gl_rasterizer: Define enum types for each vertex texcoord attribute.

This commit is contained in:
bunnei 2015-10-21 00:03:22 -04:00
parent 0ebcff710e
commit e7b1f2ae0a
3 changed files with 14 additions and 12 deletions

View file

@ -61,12 +61,12 @@ void RasterizerOpenGL::InitObjects() {
glVertexAttribPointer(GLShader::ATTRIBUTE_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, color)); glVertexAttribPointer(GLShader::ATTRIBUTE_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, color));
glEnableVertexAttribArray(GLShader::ATTRIBUTE_COLOR); glEnableVertexAttribArray(GLShader::ATTRIBUTE_COLOR);
glVertexAttribPointer(GLShader::ATTRIBUTE_TEXCOORDS + 0, 2, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, tex_coord0)); glVertexAttribPointer(GLShader::ATTRIBUTE_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, tex_coord0));
glVertexAttribPointer(GLShader::ATTRIBUTE_TEXCOORDS + 1, 2, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, tex_coord1)); glVertexAttribPointer(GLShader::ATTRIBUTE_TEXCOORD1, 2, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, tex_coord1));
glVertexAttribPointer(GLShader::ATTRIBUTE_TEXCOORDS + 2, 2, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, tex_coord2)); glVertexAttribPointer(GLShader::ATTRIBUTE_TEXCOORD2, 2, GL_FLOAT, GL_FALSE, sizeof(HardwareVertex), (GLvoid*)offsetof(HardwareVertex, tex_coord2));
glEnableVertexAttribArray(GLShader::ATTRIBUTE_TEXCOORDS + 0); glEnableVertexAttribArray(GLShader::ATTRIBUTE_TEXCOORD0);
glEnableVertexAttribArray(GLShader::ATTRIBUTE_TEXCOORDS + 1); glEnableVertexAttribArray(GLShader::ATTRIBUTE_TEXCOORD1);
glEnableVertexAttribArray(GLShader::ATTRIBUTE_TEXCOORDS + 2); glEnableVertexAttribArray(GLShader::ATTRIBUTE_TEXCOORD2);
SetShader(); SetShader();

View file

@ -68,9 +68,9 @@ GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader) {
glBindAttribLocation(program_id, Attributes::ATTRIBUTE_POSITION, "vert_position"); glBindAttribLocation(program_id, Attributes::ATTRIBUTE_POSITION, "vert_position");
glBindAttribLocation(program_id, Attributes::ATTRIBUTE_COLOR, "vert_color"); glBindAttribLocation(program_id, Attributes::ATTRIBUTE_COLOR, "vert_color");
glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORDS + 0, "vert_texcoord0"); glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD0, "vert_texcoord0");
glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORDS + 1, "vert_texcoord1"); glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD1, "vert_texcoord1");
glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORDS + 2, "vert_texcoord2"); glBindAttribLocation(program_id, Attributes::ATTRIBUTE_TEXCOORD2, "vert_texcoord2");
glLinkProgram(program_id); glLinkProgram(program_id);

View file

@ -9,9 +9,11 @@
namespace GLShader { namespace GLShader {
enum Attributes { enum Attributes {
ATTRIBUTE_POSITION = 0, ATTRIBUTE_POSITION,
ATTRIBUTE_COLOR = 1, ATTRIBUTE_COLOR,
ATTRIBUTE_TEXCOORDS = 2, ATTRIBUTE_TEXCOORD0,
ATTRIBUTE_TEXCOORD1,
ATTRIBUTE_TEXCOORD2,
}; };
/** /**