From eec4e7d0993c970c0cc8ed4a9497de86405135fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Oct 2012 18:21:35 +0200 Subject: [PATCH] Implementation of double vertex attributes in Mesh. --- src/Mesh.cpp | 6 ++++-- src/Mesh.h | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 48781627b..f62ec3563 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -101,7 +101,8 @@ void Mesh::vertexAttribPointer(const Mesh::Attribute& attribute) { #ifndef MAGNUM_TARGET_GLES if(TypeInfo::isIntegral(attribute.type)) glVertexAttribIPointer(attribute.location, attribute.count, static_cast(attribute.type), attribute.stride, reinterpret_cast(attribute.offset)); - else + else if(attribute.type == Type::Double) + glVertexAttribLPointer(attribute.location, attribute.count, static_cast(attribute.type), attribute.stride, reinterpret_cast(attribute.offset)); #endif glVertexAttribPointer(attribute.location, attribute.count, static_cast(attribute.type), GL_FALSE, attribute.stride, reinterpret_cast(attribute.offset)); } @@ -154,7 +155,8 @@ void Mesh::bindAttributeImplementationDSA(const Attribute& attribute) { #ifndef MAGNUM_TARGET_GLES if(TypeInfo::isIntegral(attribute.type)) glVertexArrayVertexAttribIOffsetEXT(vao, attribute.buffer->id(), attribute.location, attribute.count, static_cast(attribute.type), attribute.stride, attribute.offset); - else + else if(attribute.type == Type::Double) + glVertexArrayVertexAttribLOffsetEXT(vao, attribute.buffer->id(), attribute.location, attribute.count, static_cast(attribute.type), attribute.stride, attribute.offset); #endif glVertexArrayVertexAttribOffsetEXT(vao, attribute.buffer->id(), attribute.location, attribute.count, static_cast(attribute.type), GL_FALSE, attribute.stride, attribute.offset); } diff --git a/src/Mesh.h b/src/Mesh.h index da12210db..090574932 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -91,13 +91,16 @@ calls to @fn_gl{BindBuffer} and @fn_gl{BindVertexArray}. See documentation of addVertexBuffer(), addInterleavedVertexBuffer(), addVertexBufferStride() for more information. -@requires_gl30 Extension @extension{EXT,gpu_shader4} (for unsigned integer attributes) +@requires_gles30 Integer attributes are not supported in OpenGL ES 2.0. +@requires_gl30 %Extension @extension{EXT,gpu_shader4} (for integer attributes) + +@requires_gl Double attributes are supported only on Desktop OpenGL. +@requires_gl41 %Extension @extension{ARB,vertex_attrib_64bit} (for double attributes) @todo The attributes can be specified with different type than in shader - how? @todo Support for normalized values (e.g. for color as char[4] passed to shader as floating-point vec4) @todo Support for packed unsigned integer types for attributes (OpenGL 3.3, @extension{ARB,vertex_type_2_10_10_10_rev}) -@todo Support for double type for attributes (OpenGL 4.1, @extension{ARB,vertex_attrib_64bit}) @todo Support for indirect draw buffer (OpenGL 4.0, @extension{ARB,draw_indirect}) @todo Redo in a way that allows glMultiDrawArrays, glDrawArraysInstanced etc. */