mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-15 05:15:47 -04:00
GPU: Partially implemented texture support
This commit is contained in:
@ -121,7 +121,7 @@ bool Program::Link()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Program::Bind()
|
||||
void Program::Bind() const
|
||||
{
|
||||
glUseProgram(m_program_id);
|
||||
}
|
||||
@ -152,15 +152,95 @@ u32 Program::RegisterUniform(const char* name)
|
||||
return id;
|
||||
}
|
||||
|
||||
void Program::Uniform1ui(u32 index, u32 value)
|
||||
void Program::Uniform1ui(u32 index, u32 x) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform1ui(location, value);
|
||||
glUniform1ui(location, x);
|
||||
}
|
||||
|
||||
void Program::Uniform4f(u32 index, float x, float y, float z, float w)
|
||||
void Program::Uniform2ui(u32 index, u32 x, u32 y) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform2ui(location, x, y);
|
||||
}
|
||||
|
||||
void Program::Uniform3ui(u32 index, u32 x, u32 y, u32 z) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform3ui(location, x, y, z);
|
||||
}
|
||||
|
||||
void Program::Uniform4ui(u32 index, u32 x, u32 y, u32 z, u32 w) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform4ui(location, x, y, z, w);
|
||||
}
|
||||
|
||||
void Program::Uniform1i(u32 index, s32 x) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform1i(location, x);
|
||||
}
|
||||
|
||||
void Program::Uniform2i(u32 index, s32 x, s32 y) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform2i(location, x, y);
|
||||
}
|
||||
|
||||
void Program::Uniform3i(u32 index, s32 x, s32 y, s32 z) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform3i(location, x, y, z);
|
||||
}
|
||||
|
||||
void Program::Uniform4i(u32 index, s32 x, s32 y, s32 z, s32 w) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform4i(location, x, y, z, w);
|
||||
}
|
||||
|
||||
void Program::Uniform1f(u32 index, float x) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform1f(location, x);
|
||||
}
|
||||
|
||||
void Program::Uniform2f(u32 index, float x, float y) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform2f(location, x, y);
|
||||
}
|
||||
|
||||
void Program::Uniform3f(u32 index, float x, float y, float z) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
if (location >= 0)
|
||||
glUniform3f(location, x, y, z);
|
||||
}
|
||||
|
||||
void Program::Uniform4f(u32 index, float x, float y, float z, float w) const
|
||||
{
|
||||
Assert(index < m_uniform_locations.size());
|
||||
const int location = m_uniform_locations[index];
|
||||
|
@ -23,13 +23,23 @@ public:
|
||||
|
||||
bool Link();
|
||||
|
||||
void Bind();
|
||||
void Bind() const;
|
||||
|
||||
void Destroy();
|
||||
|
||||
u32 RegisterUniform(const char* name);
|
||||
void Uniform1ui(u32 index, u32 value);
|
||||
void Uniform4f(u32 index, float x, float y, float z, float w);
|
||||
void Uniform1ui(u32 index, u32 x) const;
|
||||
void Uniform2ui(u32 index, u32 x, u32 y) const;
|
||||
void Uniform3ui(u32 index, u32 x, u32 y, u32 z) const;
|
||||
void Uniform4ui(u32 index, u32 x, u32 y, u32 z, u32 w) const;
|
||||
void Uniform1i(u32 index, s32 x) const;
|
||||
void Uniform2i(u32 index, s32 x, s32 y) const;
|
||||
void Uniform3i(u32 index, s32 x, s32 y, s32 z) const;
|
||||
void Uniform4i(u32 index, s32 x, s32 y, s32 z, s32 w) const;
|
||||
void Uniform1f(u32 index, float x) const;
|
||||
void Uniform2f(u32 index, float x, float y) const;
|
||||
void Uniform3f(u32 index, float x, float y, float z) const;
|
||||
void Uniform4f(u32 index, float x, float y, float z, float w) const;
|
||||
|
||||
private:
|
||||
GLuint m_program_id = 0;
|
||||
|
@ -26,4 +26,9 @@ void Texture::Bind()
|
||||
glBindTexture(GL_TEXTURE_2D, m_id);
|
||||
}
|
||||
|
||||
void Texture::Unbind()
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
} // namespace GL
|
@ -14,6 +14,7 @@ public:
|
||||
u32 GetHeight() const { return m_height; }
|
||||
|
||||
void Bind();
|
||||
static void Unbind();
|
||||
|
||||
private:
|
||||
GLuint m_id;
|
||||
|
Reference in New Issue
Block a user