mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 03:37:54 -06:00
ENABLE_SHADERS_MANAGER -> Unified client code of new GLShadersManager and GLShaderProgram classes
This commit is contained in:
parent
cbfb09a241
commit
5aa8cc5779
10 changed files with 123 additions and 37 deletions
|
@ -1,9 +1,12 @@
|
|||
#include "libslic3r/libslic3r.h"
|
||||
#include "GLShadersManager.hpp"
|
||||
#include "3DScene.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#if ENABLE_SHADERS_MANAGER
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -71,6 +74,17 @@ GLShaderProgram* GLShadersManager::get_shader(const std::string& shader_name)
|
|||
return (it != m_shaders.end()) ? it->get() : nullptr;
|
||||
}
|
||||
|
||||
GLShaderProgram* GLShadersManager::get_current_shader()
|
||||
{
|
||||
GLint id = 0;
|
||||
glsafe(::glGetIntegerv(GL_CURRENT_PROGRAM, &id));
|
||||
if (id == 0)
|
||||
return false;
|
||||
|
||||
auto it = std::find_if(m_shaders.begin(), m_shaders.end(), [id](std::unique_ptr<GLShaderProgram>& p) { return p->get_id() == id; });
|
||||
return (it != m_shaders.end()) ? it->get() : nullptr;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // ENABLE_SHADERS_MANAGER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue