void ShaderExplodeSmoothVolumes::restoreUniformsAttribs() { bind(); *m_unif_explodeV = glGetUniformLocation(program_handler(),"explodeV"); glUniform1f (*m_unif_explodeV, m_explodeV); *m_unif_explodeF = glGetUniformLocation(program_handler(),"explodeF"); glUniform1f (*m_unif_explodeF, m_explodeF); *m_unif_ambiant = glGetUniformLocation(program_handler(),"ambient"); glUniform4fv(*m_unif_ambiant, 1, m_ambiant.data()); *m_unif_lightPos = glGetUniformLocation(program_handler(),"lightPosition"); glUniform3fv(*m_unif_lightPos, 1, m_light_pos.data()); *m_unif_plane = glGetUniformLocation(program_handler(),"plane"); glUniform4fv(*m_unif_plane, 1, m_plane.data()); bindVA_VBO("VertexPosition", m_vboPos); bindVA_VBO("VertexColor", m_vboColors); bindVA_VBO("VertexNormal", m_vboNormals); unbind(); }
void ShaderScalarField::restoreUniformsAttribs() { getLocations(); sendParams(); bind(); bindVA_VBO("VertexPosition", m_vboPos); bindVA_VBO("VertexScalar", m_vboScal); unbind(); }
void ShaderSimpleTexture::restoreUniformsAttribs() { m_unif_unit = glGetUniformLocation(this->program_handler(), "textureUnit"); bindVA_VBO("VertexPosition", m_vboPos); bindVA_VBO("VertexTexCoord", m_vboTexCoord); this->bind(); glUniform1i(*m_unif_unit,m_unit); this->unbind(); }
void ShaderSimpleFlat::restoreUniformsAttribs() { getLocations(); sendParams(); bind(); bindVA_VBO("VertexPosition", m_vboPos); if (m_vboColor) bindVA_VBO("VertexColor", m_vboColor); unbind(); }
void ShaderTextureBlurH::restoreUniformsAttribs() { m_unifTexUnit = glGetUniformLocation(this->program_handler(), "textureUnit"); m_unifBlurSize = glGetUniformLocation(this->program_handler(), "blurSize"); bindVA_VBO("VertexPosition", m_vboPos); bindVA_VBO("VertexTexCoord", m_vboTexCoord); this->bind(); glUniform1iARB(*m_unifTexUnit, m_texUnit); glUniform1f(*m_unifBlurSize, m_blurSize); this->unbind(); }
void ShaderPhong::restoreUniformsAttribs() { getLocations(); sendParams(); bind(); bindVA_VBO("VertexPosition", m_vboPos); bindVA_VBO("VertexNormal", m_vboNormal); if (m_vboColor) bindVA_VBO("VertexColor", m_vboColor); unbind(); }
unsigned int ShaderPhong::setAttributeColor(VBO* vbo) { m_vboColor = vbo; if (!m_with_color) { m_with_color=true; // set the define and recompile shader std::string gl3vert(GLSLShader::defines_gl()); gl3vert.append("#define WITH_COLOR 1\n"); gl3vert.append(vertexShaderText); std::string gl3frag(GLSLShader::defines_gl()); gl3frag.append("#define WITH_COLOR 1\n"); gl3frag.append(fragmentShaderText); loadShadersFromMemory(gl3vert.c_str(), gl3frag.c_str()); // and treat uniforms getLocations(); sendParams(); } // bind th VA with WBO bind(); unsigned int id = bindVA_VBO("VertexColor", vbo); unbind(); return id; }
unsigned int ShaderCustomTex::setAttributeTexCoord(Utils::VBO* vbo) { m_vboTexCoord = vbo; bind(); unsigned int id = bindVA_VBO("VertexTexCoord", vbo); unbind(); return id; }
unsigned int ShaderCustomTex::setAttributeNormal(Utils::VBO* vbo) { m_vboNormal = vbo; bind(); unsigned int id = bindVA_VBO("VertexNormal", vbo); unbind(); return id; }
unsigned int ShaderCustomTex::setAttributePosition(Utils::VBO* vbo) { m_vboPos = vbo; bind(); unsigned int id = bindVA_VBO("VertexPosition", vbo); unbind(); return id; }
void ShaderSimpleColor::restoreUniformsAttribs() { *m_unif_color = glGetUniformLocation(this->program_handler(), "color"); bind(); glUniform4fv(*m_unif_color, 1, m_color.data()); bindVA_VBO("VertexPosition", m_vboPos); unbind(); }
unsigned int ShaderPhong::setAttributeNormal(VBO* vbo) { m_vboNormal = vbo; bind(); unsigned int id = bindVA_VBO("VertexNormal", vbo); unbind(); return id; }
unsigned int ShaderColorDarts::setAttributeColor(VBO* vbo) { m_vboCol = vbo; bind(); unsigned int id = bindVA_VBO("VertexColor", vbo); unbind(); return id; }
unsigned int ShaderExplodeSmoothVolumes::setAttributeColor(VBO* vbo) { m_vboColors = vbo; bind(); unsigned int id = bindVA_VBO("VertexColor", vbo); unbind(); return id; }
unsigned int ShaderIsoLines::setAttributeData(VBO* vbo) { m_vboData = vbo; bind(); unsigned int id = bindVA_VBO("VertexData", vbo); unbind(); return id; }
unsigned int ShaderExplodeSmoothVolumes::setAttributePosition(VBO* vbo) { m_vboPos = vbo; bind(); unsigned int id = bindVA_VBO("VertexPosition", vbo); unbind(); return id; }
unsigned int ShaderExplodeSmoothVolumes::setAttributeNormal(VBO* vbo) { m_vboNormals = vbo; bind(); unsigned int id = bindVA_VBO("VertexNormal", vbo); unbind(); return id; }
unsigned int ShaderIsoLines::setAttributePosition(VBO* vbo) { m_vboPos = vbo; bind(); unsigned int id = bindVA_VBO("VertexPosition", vbo); unbind(); return id; }
unsigned int ShaderScalarField::setAttributeScalar(VBO* vbo) { m_vboScal = vbo; bind(); unsigned int id = bindVA_VBO("VertexScalar", vbo); unbind(); return id; }
Strings3D::Strings3D(bool withBackground, const Geom::Vec3f& bgc) : m_nbChars(0),m_scale(1.0f) { if (m_instance0 == NULL) { m_instance0 = this; std::string font_filename = Utils::GLSLShader::findFile("font_cgogn.gz"); igzstream fs(font_filename.c_str(), std::ios::in|std::ios::binary); char* buff = new char[WIDTHTEXTURE*HEIGHTTEXTURE]; fs.read(reinterpret_cast<char*>(buff), WIDTHTEXTURE*HEIGHTTEXTURE ); fs.close(); glGenTextures(1, &(*m_idTexture)); glBindTexture(GL_TEXTURE_2D, *m_idTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, WIDTHTEXTURE, HEIGHTTEXTURE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (GLvoid*)(buff)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); delete[] buff; } else { *m_idTexture = *(this->m_idTexture); } std::string glxvert(*GLSLShader::DEFINES_GL); glxvert.append(vertexShaderText); std::string glxfrag(*GLSLShader::DEFINES_GL); glxfrag.append(fragmentShaderText1); std::string background; if (!withBackground) glxfrag.append("if (lum == 0.0) discard;\n"); else if (bgc*bgc > 0.0) { std::stringstream ss; ss << " if (lum==0.0) gl_FragColor=vec4("; ss << bgc[0] << "," << bgc[1] << "," << bgc[2] << ",0.0);\n else\n"; background.append(ss.str()); } glxfrag.append(background); glxfrag.append(fragmentShaderText2); loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str()); m_vbo1 = new Utils::VBO(); m_vbo1->setDataSize(4); bindVA_VBO("VertexPosition", m_vbo1); bind(); *m_uniform_position = glGetUniformLocation(program_handler(), "strPos"); *m_uniform_color = glGetUniformLocation(program_handler(), "color"); *m_uniform_scale = glGetUniformLocation(program_handler(), "scale"); *m_uniform_texture = glGetUniformLocation(program_handler(), "FontTexture"); glUniform1f(*m_uniform_scale, 1.0f); unbind(); }
void ShaderColorDarts::restoreUniformsAttribs() { getLocations(); sendParams(); bind(); bindVA_VBO("VertexPosition", m_vboPos); unbind(); }
void ShaderExplodeVolumesAlpha::restoreUniformsAttribs() { bind(); *m_unif_ambient = glGetUniformLocation(program_handler(),"ambient"); glUniform4fv(*m_unif_ambient, 1, m_ambient.data()); *m_unif_backColor = glGetUniformLocation(program_handler(),"backColor"); glUniform4fv(*m_unif_backColor, 1, m_backColor.data()); *m_unif_lightPos = glGetUniformLocation(program_handler(),"lightPosition"); glUniform3fv(*m_unif_lightPos, 1, m_light_pos.data()); *m_unif_plane = glGetUniformLocation(program_handler(),"plane"); glUniform4fv(*m_unif_plane, 1, m_plane.data()); *m_unif_unit = glGetUniformLocation(program_handler(),"textureUnit"); glUniform1iARB(*m_unif_unit, 0); bindVA_VBO("VertexPosition", m_vboPos); bindVA_VBO("VertexColor", m_vboColors); unbind(); }
void ShaderExplodeVolumesLines::restoreUniformsAttribs() { *m_unif_explodeV = glGetUniformLocation(program_handler(),"explodeV"); *m_unif_color = glGetUniformLocation(program_handler(),"color"); *m_unif_plane = glGetUniformLocation(program_handler(),"plane"); bind(); glUniform1f (*m_unif_explodeV, m_explodeV); glUniform4fv(*m_unif_color, 1, m_color.data()); glUniform4fv(*m_unif_plane, 1, m_plane.data()); bindVA_VBO("VertexPosition", m_vboPos); unbind(); }
unsigned int ShaderSimpleTexture::setAttributePosition(VBO* vbo) { m_vboPos = vbo; return bindVA_VBO("VertexPosition", vbo); }
unsigned int ShaderSimpleTexture::setAttributeTexCoord(VBO* vbo) { m_vboTexCoord = vbo; return bindVA_VBO("VertexTexCoord", vbo); }
void ShaderExplodeVolumesAlpha::setAttributePosition(VBO* vbo) { m_vboPos = vbo; bindVA_VBO("VertexPosition", vbo); }
void ShaderExplodeVolumesAlpha::setAttributeColor(VBO* vbo) { m_vboColors = vbo; bindVA_VBO("VertexColor", vbo); }