Move samplers bindings to shaders.
This commit is contained in:
parent
2095e335ea
commit
ae3333e22e
@ -433,8 +433,7 @@ select_texture = _engine.rk_select_texture
|
||||
select_texture.restype = None
|
||||
select_texture.argtypes = (
|
||||
ctypes.c_uint, # slot
|
||||
ctypes.c_void_p, # texture
|
||||
ctypes.c_void_p) # sampler
|
||||
ctypes.c_void_p) # texture
|
||||
|
||||
draw_triangles = _engine.rk_draw_triangles
|
||||
draw_triangles.restype = None
|
||||
|
@ -155,8 +155,7 @@ RK_EXPORT void rk_set_param_mat3(
|
||||
|
||||
RK_EXPORT void rk_select_texture(
|
||||
rk_uint slot,
|
||||
rk_texture_t texture,
|
||||
rk_input_t sampler);
|
||||
rk_texture_t texture);
|
||||
|
||||
RK_EXPORT void rk_draw_triangles(
|
||||
rk_triangles_t triangles);
|
||||
|
@ -746,18 +746,15 @@ void rk_set_param_mat3(
|
||||
|
||||
void rk_select_texture(
|
||||
rk_uint slot,
|
||||
rk_texture_t _texture,
|
||||
rk_input_t _sampler) {
|
||||
rk_texture_t _texture) {
|
||||
rk_texture const * const texture = reinterpret_cast<rk_texture const *>(_texture);
|
||||
GLint const sampler = reinterpret_cast<intptr_t>(_sampler) - 1;
|
||||
if (texture && sampler > -1) {
|
||||
if (texture) {
|
||||
glActiveTexture(GL_TEXTURE0 + slot);
|
||||
if (texture->nlevels) {
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, texture->texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, texture->texture);
|
||||
}
|
||||
glUniform1i(sampler, slot);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user