Browse Source

Implementation of double vertex attributes in Mesh.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
eec4e7d099
  1. 6
      src/Mesh.cpp
  2. 7
      src/Mesh.h

6
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<GLenum>(attribute.type), attribute.stride, reinterpret_cast<const GLvoid*>(attribute.offset));
else
else if(attribute.type == Type::Double)
glVertexAttribLPointer(attribute.location, attribute.count, static_cast<GLenum>(attribute.type), attribute.stride, reinterpret_cast<const GLvoid*>(attribute.offset));
#endif
glVertexAttribPointer(attribute.location, attribute.count, static_cast<GLenum>(attribute.type), GL_FALSE, attribute.stride, reinterpret_cast<const GLvoid*>(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<GLenum>(attribute.type), attribute.stride, attribute.offset);
else
else if(attribute.type == Type::Double)
glVertexArrayVertexAttribLOffsetEXT(vao, attribute.buffer->id(), attribute.location, attribute.count, static_cast<GLenum>(attribute.type), attribute.stride, attribute.offset);
#endif
glVertexArrayVertexAttribOffsetEXT(vao, attribute.buffer->id(), attribute.location, attribute.count, static_cast<GLenum>(attribute.type), GL_FALSE, attribute.stride, attribute.offset);
}

7
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.
*/

Loading…
Cancel
Save