mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
GL: Bind the textures to the shaders used for drawing.
This commit is contained in:
parent
65faeb9b2a
commit
cb3183212d
|
@ -524,10 +524,10 @@ void main() {
|
|||
in vec2 frag_tex_coord;
|
||||
out vec4 color;
|
||||
|
||||
uniform sampler2D color_texture;
|
||||
uniform sampler2D tex[32];
|
||||
|
||||
void main() {
|
||||
color = vec4(1.0, 0.0, 1.0, 0.0);
|
||||
color = texture(tex[0], frag_tex_coord);
|
||||
}
|
||||
)";
|
||||
|
||||
|
@ -548,6 +548,15 @@ void main() {
|
|||
state.draw.shader_program = test_shader.shader.handle;
|
||||
state.Apply();
|
||||
|
||||
for (u32 texture = 0; texture < texture_samplers.size(); ++texture) {
|
||||
// Set the texture samplers to correspond to different texture units
|
||||
std::string uniform_name = "tex[" + std::to_string(texture) + "]";
|
||||
GLint uniform_tex = glGetUniformLocation(test_shader.shader.handle, uniform_name.c_str());
|
||||
if (uniform_tex != -1) {
|
||||
glUniform1i(uniform_tex, TextureUnits::MaxwellTexture(texture).id);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_ARB_separate_shader_objects) {
|
||||
state.draw.shader_program = 0;
|
||||
state.Apply();
|
||||
|
|
Loading…
Reference in a new issue