void CompositeProcessorGL::compositePortsToOutport(ImageOutport& outport, ImageType type, ImageInport& inport) { if (inport.isReady() && outport.hasData()) { utilgl::activateTarget(outport, type); shader_.activate(); TextureUnitContainer units; utilgl::bindAndSetUniforms(shader_, units, *inport.getData(), "tex0", ImageType::ColorDepthPicking); utilgl::bindAndSetUniforms(shader_, units, *outport.getData(), "tex1", ImageType::ColorDepthPicking); utilgl::setShaderUniforms(shader_, outport, "outportParameters"); utilgl::singleDrawImagePlaneRect(); shader_.deactivate(); utilgl::deactivateCurrentTarget(); } }
void bindAndSetUniforms(Shader& shader, TextureUnitContainer& cont, ImageOutport& port, ImageType type) { bindAndSetUniforms(shader, cont, *port.getData(), port.getIdentifier(), type); }
void setShaderUniforms(Shader& shader, const ImageOutport& outport, const std::string samplerID) { setShaderUniforms(shader, *outport.getData(), samplerID.empty() ? outport.getIdentifier() + "Parameters" : samplerID); }
void unbindTextures(const ImageOutport& outport) { unbindTextures(*outport.getData(), true, true, true); }
void unbindPickingTexture(const ImageOutport& outport) { unbindTextures(*outport.getData(), false, false, true); }
void unbindDepthTexture(const ImageOutport& outport) { unbindTextures(*outport.getData(), false, true, false); }
void bindTextures(const ImageOutport& outport, const TextureUnit& colorTexUnit, const TextureUnit& depthTexUnit, const TextureUnit& pickingTexUnit) { bindTextures(*outport.getData(), true, true, true, colorTexUnit.getEnum(), depthTexUnit.getEnum(), pickingTexUnit.getEnum()); }
void bindPickingTexture(const ImageOutport& outport, const TextureUnit& texUnit) { bindTextures(*outport.getData(), false, false, true, 0, 0, texUnit.getEnum()); }
void bindColorTexture(const ImageOutport& outport, const TextureUnit& texUnit) { bindTextures(*outport.getData(), true, false, false, texUnit.getEnum(), 0, 0); }
void bindTextures(const ImageOutport& outport, GLenum colorTexUnit, GLenum depthTexUnit, GLenum pickingTexUnit) { bindTextures(*outport.getData(), true, true, true, colorTexUnit, depthTexUnit, pickingTexUnit); }
void bindPickingTexture(const ImageOutport& outport, GLenum texUnit) { bindTextures(*outport.getData(), false, false, true, 0, 0, texUnit); }
void bindDepthTexture(const ImageOutport& outport, GLenum texUnit) { bindTextures(*outport.getData(), false, true, false, 0, texUnit, 0); }