/// Compile this shader. /// /// Will terminate program on failure. void compile() const { #if defined(USE_LD) std::string pretty_source = this->str(); const GLchar *pretty_source_c_str = pretty_source.c_str(); dnload_glShaderSource(m_id, 1, &pretty_source_c_str, NULL); #else dnload_glShaderSource(m_id, m_parts.size(), const_cast<const GLchar**>(m_parts.getData()), NULL); #endif dnload_glCompileShader(m_id); #if defined(USE_LD) std::string log = GlslShaderSource::get_shader_info_log(m_id); if(0 < log.length()) { std::cout << GlslShaderSource::string_add_line_numbers(pretty_source) << std::endl; std::cout << log << std::endl; } if(!GlslShaderSource::get_shader_compile_status(m_id)) { teardown(); exit(1); } #endif }
/// Update this element buffer into the GPU. /// /// Empty data will not be updated. /// /// \param data Data to update. void update(const seq<uint16_t> &data) const { if(!data) { return; } #if 0 for(unsigned ii = 0; (ii < data.size()); ii += 3) { std::cout << data[ii] << ", " << data[ii + 1] << ", " << data[ii + 2] << std::endl; } #endif bind(); dnload_glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.getSizeBytes(), data.getData(), GL_STATIC_DRAW); #if defined(USE_LD) vgl::increment_data_size_index(data.getSizeBytes()); #endif }