/** * @glsymbols * @glfunref{VertexAttribPointer} */ const VertexAttribArray& LPointer( GLuint values_per_vertex, DataType data_type, GLsizei stride, const void* pointer ) const { #if GL_VERSION_4_2 || GL_ARB_vertex_attrib_64bit OGLPLUS_GLFUNC(VertexAttribLPointer)( _location, values_per_vertex, GLenum(data_type), stride, pointer ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(VertexAttribLPointer)); #else OGLPLUS_FAKE_USE(values_per_vertex); OGLPLUS_FAKE_USE(data_type); OGLPLUS_FAKE_USE(stride); OGLPLUS_FAKE_USE(pointer); assert(! "The glVertexAttribLPointer function is " "required but not available! Double-precision " "vertex attribute values are not supported." ); #endif return *this; }
/// Set a property key/value to the exception void SetPropertyValue(const String& key, const String& value) { #if !OGLPLUS_ERROR_NO_PROPERTIES _properties[key] = value; #else OGLPLUS_FAKE_USE(key); OGLPLUS_FAKE_USE(value); #endif }
inline bool ValidUTF8(const char* begin, const char* end) { #if !OGLPLUS_NO_UTF8_CHECKS UTF8Validator valid_utf8; return valid_utf8(begin, end); #else OGLPLUS_FAKE_USE(begin); OGLPLUS_FAKE_USE(end); return true; #endif }
inline bool ValidUTF8(Iterator begin, Iterator end) { #if !OGLPLUS_NO_UTF8_CHECKS UTF8Validator<Iterator> valid_utf8; return valid_utf8(begin, end); #else OGLPLUS_FAKE_USE(begin); OGLPLUS_FAKE_USE(end); return true; #endif }
// TODO: this is here only because GLEW defines // glGetTransformFeedbackVaryings this way ActiveVariableInfo( ProgramInterfaceContext& context, GLuint index, void (GLAPIENTRY *GetActiveVariable)(GLuint, GLuint, GLint*) ): _index(index) , _size(0) , _type(0) , _name(0) { OGLPLUS_FAKE_USE(context); OGLPLUS_FAKE_USE(GetActiveVariable); }
/// Creates a cloud image of given @p width, @p height and @p depth Cloud( GLsizei width, GLsizei height, GLsizei depth, const Vec3f& origin = Vec3f(0.0f, -0.3f, 0.0f), GLfloat init_radius = 0.7f, GLfloat sub_scale = 0.333f, GLfloat sub_variance = 0.5f, GLfloat min_radius = 0.04f ): Image(width, height, depth, 1, (GLubyte*)0) , _sub_scale(sub_scale) , _sub_variance(sub_variance) , _min_radius(min_radius) { auto p = this->_begin_ub(), e = this->_end_ub(); for(GLsizei k=0; k!=depth; ++k) for(GLsizei j=0; j!=height; ++j) for(GLsizei i=0; i!=width; ++i) { assert(p != e); *p = GLubyte(0); ++p; } OGLPLUS_FAKE_USE(e); assert(p == e); _make_spheres(origin, init_radius); }
VectorBase(const T* v, std::size_t n) { OGLPLUS_FAKE_USE(n); assert(n >= N); std::copy(v, v+N, _elem); }
static void _apply_gradient( Combine combine, const std::vector<Vector<T, N>>& grad0, const std::vector<Vector<T, N>>& grad1, const std::vector<Vector<T, N>>& grad2, GLubyte* dp, GLubyte* de ) { auto gb0 = grad0.begin(), ge0 = grad0.end(); auto gb1 = grad1.begin(), ge1 = grad1.end(); auto gb2 = grad2.begin(), ge2 = grad2.end(); for(auto gp0=gb0; gp0!=ge0; ++gp0) for(auto gp1=gb1; gp1!=ge1; ++gp1) for(auto gp2=gb2; gp2!=ge2; ++gp2) { Vector<T, N> color = combine(*gp0, *gp1, *gp2); for(std::size_t c=0; c!=N; ++c) { assert(dp != de); *dp++ = GLubyte(_clamp(color.At(c))*_cc_max()); } } OGLPLUS_FAKE_USE(de); assert(dp == de); }
/** Constructs an instance of VertexAttribArray for a vertex attribute * at the specified @p location in a @p program. * * @see VertexAttribArray */ inline VertexAttribArray operator | ( const ProgramOps& program, GLuint location ) { OGLPLUS_FAKE_USE(program); return VertexAttribArray(VertexAttribSlot(location)); }
/** * The result of this function is also influenced by the * #OGLPLUS_ERROR_INFO_NO_OBJECT_DESC preprocessor configuration option. * If set to zero this function behaves as described above, otherwise it * returns an empty string. * * @see ErrorInfo * @see ErrorGLSymbol() * @see ErrorFile() * @see ErrorFunc() * @see ErrorLine() * @see ErrorClassName() * @see ErrorBindTarget() * * @ingroup error_handling */ inline const String& ErrorObjectDescription(const ErrorInfo& info) { OGLPLUS_FAKE_USE(info); #if !OGLPLUS_ERROR_INFO_NO_OBJECT_DESC if((info._get_obj_desc != 0) && (info._obj_name != 0)) return info._get_obj_desc(info._obj_name); #endif return aux::EmptyString(); }
void Trace(const ErrorInfo& info) { #if !OGLPLUS_ERROR_NO_PROPAGATION_INFO _propagation.push_back(info); #else OGLPLUS_FAKE_USE(info); #endif throw; }
/** * The result of this function is also influenced by the * #OGLPLUS_ERROR_INFO_NO_FUNC preprocessor configuration option. * If set to zero this function behaves as described above, otherwise it * returns an empty C string. * * @see ErrorInfo * @see ErrorGLSymbol() * @see ErrorFile() * @see ErrorLine() * @see ErrorClassName() * @see ErrorBindTarget() * @see ErrorObjectDescription() * * @ingroup error_handling */ inline const char* ErrorFunc(const ErrorInfo& info) { #if !OGLPLUS_ERROR_INFO_NO_FUNC return info._func; #else OGLPLUS_FAKE_USE(info); return ""; #endif }
/** * The result of this function is also influenced by the * #OGLPLUS_ERROR_INFO_NO_LINE preprocessor configuration option. * If set to zero this function behaves as described above, otherwise it * returns zero. * * @see ErrorInfo * @see ErrorGLSymbol() * @see ErrorFile() * @see ErrorFunc() * @see ErrorClassName() * @see ErrorBindTarget() * @see ErrorObjectDescription() * * @ingroup error_handling */ inline unsigned ErrorLine(const ErrorInfo& info) { #if !OGLPLUS_ERROR_INFO_NO_LINE return info._line; #else OGLPLUS_FAKE_USE(info); return 0; #endif }
/** * The result of this function is also influenced by the * #OGLPLUS_ERROR_INFO_NO_FILE preprocessor configuration option. * If set to zero this function behaves as described above, otherwise it * returns an empty C string. * * @see ErrorInfo * @see ErrorGLSymbol() * @see ErrorFunc() * @see ErrorLine() * @see ErrorClassName() * @see ErrorBindTarget() * @see ErrorObjectDescription() * * @ingroup error_handling */ inline const char* ErrorFile(const ErrorInfo& info) { #if !OGLPLUS_ERROR_INFO_NO_FILE return info._file; #else OGLPLUS_FAKE_USE(info); return ""; #endif }
/** * The result of this function is also influenced by the * #OGLPLUS_ERROR_INFO_NO_BIND_TARGET preprocessor configuration option. * If set to zero this function behaves as described above, otherwise it * returns the string "UnknownTarget". * * @see ErrorInfo * @see ErrorGLSymbol() * @see ErrorFile() * @see ErrorFunc() * @see ErrorLine() * @see ErrorClassName() * @see ErrorObjectDescription() * * @ingroup error_handling */ inline const char* ErrorBindTarget(const ErrorInfo& info) { OGLPLUS_FAKE_USE(info); return #if !OGLPLUS_ERROR_INFO_NO_BIND_TARGET (info._bind_tgt) ? info._bind_tgt.c_str() : #endif "UnknownTarget"; }
friend void BitmapGlyphDeallocateLayoutData( BitmapGlyphRenderingBase& that, BitmapGlyphLayoutData& layout_data ) { OGLPLUS_FAKE_USE(that); assert(layout_data._storage); BitmapGlyphLayoutStorage& _storage = *layout_data._storage; _storage.Deallocate(layout_data); }
/** * The result of this function is also influenced by the * #OGLPLUS_ERROR_INFO_NO_CLASS_NAME preprocessor configuration option. * If set to zero this function behaves as described above, otherwise it * returns the string "UnknownClass". * * @see ErrorInfo * @see ErrorGLSymbol() * @see ErrorFile() * @see ErrorFunc() * @see ErrorLine() * @see ErrorBindTarget() * @see ErrorObjectDescription() * * @ingroup error_handling */ inline const char* ErrorClassName(const ErrorInfo& info) { #if !OGLPLUS_ERROR_INFO_NO_CLASS_NAME return (info._cls_name && *info._cls_name) ? info._cls_name : "UnknownClass"; #else OGLPLUS_FAKE_USE(info); return "UnknownClass"; #endif }
inline StrCRef EnumValueName(EnumType enum_value) { #if !OALPLUS_NO_ENUM_VALUE_NAMES typedef typename EnumBaseType<EnumType>::Type BaseType; return ValueName_( (EnumType*)nullptr, BaseType(enum_value) ); #else OGLPLUS_FAKE_USE(enum_value); return StrCRef(); #endif }
Error( GLenum code, const char* desc, const ErrorInfo& info, PropertyMapInit&& properties ): std::runtime_error(desc) , _code(code) , _info(info) #if !OGLPLUS_ERROR_NO_PROPERTIES , _properties(std::move(properties)) #endif , _assertion(false) { #if OGLPLUS_ERROR_NO_PROPERTIES OGLPLUS_FAKE_USE(properties); #endif }
// makes vertices placed above the sphere used to adujst // the normals for bump-mapping // there vertices must be transformed just like // the sphere vertices static void make_hole_data(std::vector<GLfloat>& data, GLuint hole_count) { const GLuint ne = 5; const float el[ne] = {0.50f, 0.33f, 0.21f, 0.11f, 0.07f}; const GLuint ea[ne] = {1, 6, 6, 6, 6}; const float ao[ne] = {0.00f, 0.00f, 0.50f,-0.08f, 0.42f}; const float si[2] = {1.0f, -1.0f}; GLuint k = 0; if(ne != 0) { GLuint hn = 0; for(GLuint e=0; e!=ne; ++e) hn += ea[e]; assert(hn * 2 == hole_count); data.resize(hn * 2 * 3); } for(GLuint s=0; s!= 2; ++s) for(GLuint e=0; e!=ne; ++e) { GLuint na = ea[e]; if(na == 1) { data[k++] = 0.0f; data[k++] = si[s]; data[k++] = 0.0f; } else if(na > 1) { float elev = el[e] * math::Pi(); float a_step = 1.0f / na; for(GLuint a=0; a!=na; ++a) { float azim = si[s]*ao[e]+a*a_step*math::TwoPi(); data[k++] = std::cos(elev)*std::cos(azim); data[k++] = std::sin(elev * si[s]); data[k++] = std::cos(elev)*std::sin(azim); } } } OGLPLUS_FAKE_USE(hole_count); assert(k == hole_count * 3); assert(k == data.size()); }
Cloud2D(const Cloud& cloud) : Image(cloud.Width(), cloud.Height(), 1, 3, (GLubyte*)0) { auto p = this->_begin_ub(); auto e = this->_end_ub(); GLsizei w = Width(), h = Height(), d = cloud.Depth(); for(GLsizei j=0; j!=h; ++j) for(GLsizei i=0; i!=w; ++i) { GLubyte depth_near = 0; GLubyte depth_far = 0; GLuint total_density = 0; for(GLsizei k=0; k!=d; ++k) { GLubyte c = cloud.ComponentAs<GLubyte>(i, j, k, 0); if(depth_near == 0) { if(c != 0) { depth_near = (256*k)/d; depth_far = depth_near; } } else if(depth_far == depth_near) { if(c == 0) depth_far = (256*k)/d; } total_density += c; } assert(depth_far >= depth_near); GLuint avg_density = ((depth_far-depth_near) > 0)? total_density/(depth_far-depth_near):0; assert(p != e); *p = depth_near; ++p; assert(p != e); *p = depth_far; ++p; assert(p != e); *p = GLubyte(avg_density); ++p; } OGLPLUS_FAKE_USE(e); assert(p == e); }
static void _apply_gradient( const std::vector<Vector<T, N>>& grad0, GLubyte* dp, GLubyte* de ) { auto gb0 = grad0.begin(), ge0 = grad0.end(); for(auto gp0=gb0; gp0!=ge0; ++gp0) { Vector<T, N> color = *gp0; for(std::size_t c=0; c!=N; ++c) { assert(dp != de); *dp++ = GLubyte(_clamp(color.At(c))*_cc_max()); } } OGLPLUS_FAKE_USE(de); assert(dp == de); }
friend void BitmapGlyphInitializeLayoutData( BitmapGlyphRenderingBase& that, BitmapGlyphLayoutData& layout_data, BitmapFont& font, const CodePoint* cps, GLsizei length ) { OGLPLUS_FAKE_USE(that); assert(layout_data._storage); BitmapGlyphLayoutStorage& _storage = *layout_data._storage; std::vector<GLfloat> x_offsets; GLfloat width = font.QueryXOffsets(cps, length, x_offsets); _storage.Initialize( layout_data, width, x_offsets, cps, length ); }
> static void _make_gradient( const Vector<T, N>& background, GLsizei dimension, const std::map<P, Vector<T, N>>& points, std::vector<Vector<T, N>>& gradient ) { auto point_cur = points.begin(), point_end = points.end(); auto grad_cur = gradient.begin(), grad_end = gradient.end(); const P step = P(1)/P(dimension); P prev_point = P(0); P curr_point = P(0); P next_point = P(1); Vector<T, N> prev_color = background; Vector<T, N> next_color = background; for(GLsizei p=0; p!=dimension; ++p) { if(point_cur != point_end) { if(point_cur->first <= curr_point) { prev_point = point_cur->first; auto npp = point_cur; ++npp; if(npp != point_end) { prev_color = point_cur->second; next_point = npp->first; next_color = npp->second; point_cur = npp; } else { prev_color = background; next_point = P(1); next_color = background; } } else { next_point = point_cur->first; } } P factor = P(0); if(prev_point != next_point) factor =(curr_point - prev_point)/ (next_point - prev_point); assert(grad_cur != grad_end); *grad_cur = prev_color*(P(1)-factor)+next_color*factor; ++grad_cur; curr_point += step; } assert(grad_cur == grad_end); OGLPLUS_FAKE_USE(grad_end); }
void OGLplusExampleGLWidget::mousePressEvent(QMouseEvent *mouse_event) { OGLPLUS_FAKE_USE(mouse_event); }