Skip to content

Commit

Permalink
RetroPlayer: Whitespace change for upcoming GL shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
garbear committed Jul 10, 2023
1 parent 472413b commit 80441c6
Showing 1 changed file with 36 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,50 +288,52 @@ void CRPRendererOpenGL::Render(uint8_t alpha)
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

m_context.EnableGUIShader(GL_SHADER_METHOD::TEXTURE);
{
m_context.EnableGUIShader(GL_SHADER_METHOD::TEXTURE);

GLubyte colour[4];
GLubyte idx[4] = {0, 1, 3, 2}; // Determines order of triangle strip
PackedVertex vertex[4];
GLubyte colour[4];
GLubyte idx[4] = {0, 1, 3, 2}; // Determines order of triangle strip
PackedVertex vertex[4];

GLint uniColLoc = m_context.GUIShaderGetUniCol();
GLint uniColLoc = m_context.GUIShaderGetUniCol();

// Setup color values
colour[0] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::R, color);
colour[1] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::G, color);
colour[2] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::B, color);
colour[3] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::A, color);
// Setup color values
colour[0] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::R, color);
colour[1] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::G, color);
colour[2] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::B, color);
colour[3] = UTILS::GL::GetChannelFromARGB(UTILS::GL::ColorChannel::A, color);

for (unsigned int i = 0; i < 4; i++)
{
// Setup vertex position values
vertex[i].x = m_rotatedDestCoords[i].x;
vertex[i].y = m_rotatedDestCoords[i].y;
vertex[i].z = 0.0f;
}
for (unsigned int i = 0; i < 4; i++)
{
// Setup vertex position values
vertex[i].x = m_rotatedDestCoords[i].x;
vertex[i].y = m_rotatedDestCoords[i].y;
vertex[i].z = 0.0f;
}

// Setup texture coordinates
vertex[0].u1 = vertex[3].u1 = rect.x1;
vertex[0].v1 = vertex[1].v1 = rect.y1;
vertex[1].u1 = vertex[2].u1 = rect.x2;
vertex[2].v1 = vertex[3].v1 = rect.y2;
// Setup texture coordinates
vertex[0].u1 = vertex[3].u1 = rect.x1;
vertex[0].v1 = vertex[1].v1 = rect.y1;
vertex[1].u1 = vertex[2].u1 = rect.x2;
vertex[2].v1 = vertex[3].v1 = rect.y2;

glBindVertexArray(m_mainVAO);
glBindVertexArray(m_mainVAO);

glBindBuffer(GL_ARRAY_BUFFER, m_mainVertexVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex) * 4, &vertex[0], GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, m_mainVertexVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex) * 4, &vertex[0], GL_STATIC_DRAW);

// No need to bind the index VBO, it's part of VAO state
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte) * 4, idx, GL_STATIC_DRAW);
// No need to bind the index VBO, it's part of VAO state
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte) * 4, idx, GL_STATIC_DRAW);

glUniform4f(uniColLoc, (colour[0] / 255.0f), (colour[1] / 255.0f), (colour[2] / 255.0f),
(colour[3] / 255.0f));
glUniform4f(uniColLoc, (colour[0] / 255.0f), (colour[1] / 255.0f), (colour[2] / 255.0f),
(colour[3] / 255.0f));

glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, 0);
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, 0);

// Unbind VAO/VBO just to be safe
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
// Unbind VAO/VBO just to be safe
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

m_context.DisableGUIShader();
m_context.DisableGUIShader();
}
}

0 comments on commit 80441c6

Please sign in to comment.