MCPcopy Create free account
hub / github.com/SFML/SFML / bind

Method bind

src/SFML/Graphics/Shader.cpp:779–808  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

777
778////////////////////////////////////////////////////////////
779void Shader::bind(const Shader* shader)
780{
781 const TransientContextLock lock;
782
783 // Make sure that we can use shaders
784 if (!isAvailable())
785 {
786 err() << "Failed to bind or unbind shader: your system doesn't support shaders "
787 << "(you should test Shader::isAvailable() before trying to use the Shader class)" << std::endl;
788 return;
789 }
790
791 if (shader && shader->m_shaderProgram)
792 {
793 // Enable the program
794 glCheck(GLEXT_glUseProgramObject(castToGlHandle(shader->m_shaderProgram)));
795
796 // Bind the textures
797 shader->bindTextures();
798
799 // Bind the current texture
800 if (shader->m_currentTexture != -1)
801 glCheck(GLEXT_glUniform1i(shader->m_currentTexture, 0));
802 }
803 else
804 {
805 // Bind no shader
806 glCheck(GLEXT_glUseProgramObject({}));
807 }
808}
809
810
811////////////////////////////////////////////////////////////

Callers 2

UdpSocket.test.cppFile · 0.45
runUdpServerFunction · 0.45

Calls 2

bindTexturesMethod · 0.80
isAvailableFunction · 0.50

Tested by

no test coverage detected