Browse Source

Use "constructor cast" instead of `static_cast<GL...>(...)`.

Makes the lines shorter, the conversions are mainly from strongly-typed
enums to underlying type, so nothing potentially harmful which should be
marked with static_cast.
pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
d6c4bb0300
  1. 12
      src/AbstractFramebuffer.cpp
  2. 37
      src/AbstractTexture.cpp
  3. 4
      src/AbstractTexture.h
  4. 22
      src/Buffer.cpp
  5. 10
      src/CubeMapTexture.h
  6. 2
      src/CubeMapTextureArray.h
  7. 2
      src/DefaultFramebuffer.cpp
  8. 4
      src/DefaultFramebuffer.h
  9. 4
      src/Framebuffer.cpp
  10. 6
      src/Mesh.cpp
  11. 12
      src/Mesh.h
  12. 2
      src/Query.h
  13. 2
      src/Shader.cpp
  14. 2
      src/Texture.h

12
src/AbstractFramebuffer.cpp

@ -112,7 +112,7 @@ void AbstractFramebuffer::bindInternal(FramebufferTarget target) {
state->readBinding = state->drawBinding = _id;
} else CORRADE_ASSERT_UNREACHABLE();
glBindFramebuffer(static_cast<GLenum>(target), _id);
glBindFramebuffer(GLenum(target), _id);
}
FramebufferTarget AbstractFramebuffer::bindInternal() {
@ -144,7 +144,7 @@ void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer&
destination.bindInternal(FramebufferTarget::Draw);
/** @todo Get some extension wrangler instead to avoid undeclared glBlitFramebuffer() on ES2 */
#ifndef MAGNUM_TARGET_GLES2
glBlitFramebuffer(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), static_cast<GLbitfield>(mask), static_cast<GLenum>(filter));
glBlitFramebuffer(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
#else
static_cast<void>(sourceRectangle);
static_cast<void>(destinationRectangle);
@ -183,7 +183,7 @@ void AbstractFramebuffer::clear(FramebufferClearMask mask) {
#else
bindInternal(drawTarget);
#endif
glClear(static_cast<GLbitfield>(mask));
glClear(GLbitfield(mask));
}
void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Image2D& image) {
@ -377,17 +377,17 @@ void AbstractFramebuffer::readBufferImplementationDSA(GLenum buffer) {
#endif
void AbstractFramebuffer::readImplementationDefault(const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const std::size_t, GLvoid* const data) {
glReadPixels(offset.x(), offset.y(), size.x(), size.y(), static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glReadPixels(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
}
#ifndef MAGNUM_TARGET_GLES3
void AbstractFramebuffer::readImplementationRobustness(const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) {
/** @todo Enable when extension wrangler for ES is available */
#ifndef MAGNUM_TARGET_GLES
glReadnPixelsARB(offset.x(), offset.y(), size.x(), size.y(), static_cast<GLenum>(format), static_cast<GLenum>(type), dataSize, data);
glReadnPixelsARB(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), dataSize, data);
#else
CORRADE_INTERNAL_ASSERT(false);
//glReadnPixelsEXT(offset.x(), offset.y(), size.x(), size.y(), static_cast<GLenum>(format), static_cast<GLenum>(type), data);
//glReadnPixelsEXT(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
static_cast<void>(offset);
static_cast<void>(size);
static_cast<void>(format);

37
src/AbstractTexture.cpp

@ -190,8 +190,7 @@ AbstractTexture& AbstractTexture::setMinificationFilter(Sampler::Filter filter,
CORRADE_ASSERT(_target != GL_TEXTURE_RECTANGLE || mipmap == Sampler::Mipmap::Base, "AbstractTexture: rectangle textures cannot have mipmaps", *this);
#endif
(this->*parameteriImplementation)(GL_TEXTURE_MIN_FILTER,
static_cast<GLint>(filter)|static_cast<GLint>(mipmap));
(this->*parameteriImplementation)(GL_TEXTURE_MIN_FILTER, GLint(filter)|GLint(mipmap));
return *this;
}
@ -886,22 +885,22 @@ void AbstractTexture::getImageImplementationRobustness(const GLenum target, cons
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal();
glTexImage1D(target, level, static_cast<GLint>(internalFormat), size[0], 0, static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTexImage1D(target, level, GLint(internalFormat), size[0], 0, GLenum(format), GLenum(type), data);
}
void AbstractTexture::imageImplementationDSA(GLenum target, GLint level, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data) {
glTextureImage1DEXT(_id, target, level, GLint(internalFormat), size[0], 0, static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTextureImage1DEXT(_id, target, level, GLint(internalFormat), size[0], 0, GLenum(format), GLenum(type), data);
}
#endif
void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, TextureFormat internalFormat, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal();
glTexImage2D(target, level, GLint(internalFormat), size.x(), size.y(), 0, static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTexImage2D(target, level, GLint(internalFormat), size.x(), size.y(), 0, GLenum(format), GLenum(type), data);
}
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::imageImplementationDSA(GLenum target, GLint level, TextureFormat internalFormat, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data) {
glTextureImage2DEXT(_id, target, level, GLint(internalFormat), size.x(), size.y(), 0, static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTextureImage2DEXT(_id, target, level, GLint(internalFormat), size.x(), size.y(), 0, GLenum(format), GLenum(type), data);
}
#endif
@ -909,7 +908,7 @@ void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, Tex
bindInternal();
/** @todo Get some extension wrangler instead to avoid linker errors to glTexImage3D() on ES2 */
#ifndef MAGNUM_TARGET_GLES2
glTexImage3D(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTexImage3D(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data);
#else
static_cast<void>(target);
static_cast<void>(level);
@ -923,29 +922,29 @@ void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, Tex
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::imageImplementationDSA(GLenum target, GLint level, TextureFormat internalFormat, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) {
glTextureImage3DEXT(_id, target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTextureImage3DEXT(_id, target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal();
glTexSubImage1D(target, level, offset[0], size[0], static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTexSubImage1D(target, level, offset[0], size[0], GLenum(format), GLenum(type), data);
}
void AbstractTexture::subImageImplementationDSA(GLenum target, GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLsizei>& size, ColorFormat format, ColorType type, const GLvoid* data) {
glTextureSubImage1DEXT(_id, target, level, offset[0], size[0], static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTextureSubImage1DEXT(_id, target, level, offset[0], size[0], GLenum(format), GLenum(type), data);
}
#endif
void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal();
glTexSubImage2D(target, level, offset.x(), offset.y(), size.x(), size.y(), static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTexSubImage2D(target, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
}
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::subImageImplementationDSA(GLenum target, GLint level, const Vector2i& offset, const Vector2i& size, ColorFormat format, ColorType type, const GLvoid* data) {
glTextureSubImage2DEXT(_id, target, level, offset.x(), offset.y(), size.x(), size.y(), static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTextureSubImage2DEXT(_id, target, level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
}
#endif
@ -953,7 +952,7 @@ void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level,
bindInternal();
/** @todo Get some extension wrangler instead to avoid linker errors to glTexSubImage3D() on ES2 */
#ifndef MAGNUM_TARGET_GLES2
glTexSubImage3D(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTexSubImage3D(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
#else
static_cast<void>(target);
static_cast<void>(level);
@ -967,7 +966,7 @@ void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level,
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::subImageImplementationDSA(GLenum target, GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) {
glTextureSubImage3DEXT(_id, target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), static_cast<GLenum>(format), static_cast<GLenum>(type), data);
glTextureSubImage3DEXT(_id, target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
}
#endif
@ -1124,15 +1123,15 @@ void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture* texture, const
CORRADE_ASSERT(texture->_target != GL_TEXTURE_RECTANGLE || ((wrapping.x() == Sampler::Wrapping::ClampToEdge || wrapping.x() == Sampler::Wrapping::ClampToBorder) && (wrapping.y() == Sampler::Wrapping::ClampToEdge || wrapping.y() == Sampler::Wrapping::ClampToEdge)), "AbstractTexture: rectangle texture wrapping must either clamp to border or to edge", );
#endif
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, static_cast<GLint>(wrapping.x()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_T, static_cast<GLint>(wrapping.y()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y()));
}
void AbstractTexture::DataHelper<3>::setWrapping(AbstractTexture* texture, const Array3D<Sampler::Wrapping>& wrapping) {
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, static_cast<GLint>(wrapping.x()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_T, static_cast<GLint>(wrapping.y()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y()));
#ifndef MAGNUM_TARGET_GLES
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_R, static_cast<GLint>(wrapping.z()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_R, GLint(wrapping.z()));
#endif
}
#endif

4
src/AbstractTexture.h

@ -216,7 +216,7 @@ class MAGNUM_EXPORT AbstractTexture {
* with @def_gl{TEXTURE_MAG_FILTER}
*/
AbstractTexture& setMagnificationFilter(Sampler::Filter filter) {
(this->*parameteriImplementation)(GL_TEXTURE_MAG_FILTER, static_cast<GLint>(filter));
(this->*parameteriImplementation)(GL_TEXTURE_MAG_FILTER, GLint(filter));
return *this;
}
@ -478,7 +478,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> {
static Math::Vector<1, GLint> imageSize(AbstractTexture* texture, GLenum target, GLint level);
static void setWrapping(AbstractTexture* texture, const Array1D<Sampler::Wrapping>& wrapping) {
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, static_cast<GLint>(wrapping.x()));
(texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x()));
}
static void setStorage(AbstractTexture* texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size) {

22
src/Buffer.cpp

@ -170,7 +170,7 @@ void Buffer::bind(Target target, GLuint id) {
/* Bind the buffer otherwise */
bound = id;
glBindBuffer(static_cast<GLenum>(target), id);
glBindBuffer(GLenum(target), id);
}
Buffer::Target Buffer::bindInternal(Target hint) {
@ -187,7 +187,7 @@ Buffer::Target Buffer::bindInternal(Target hint) {
/* Bind the buffer to hint target otherwise */
hintBinding = _id;
glBindBuffer(static_cast<GLenum>(hint), _id);
glBindBuffer(GLenum(hint), _id);
return hint;
}
@ -206,7 +206,7 @@ void* Buffer::mapSub(const GLintptr offset, const GLsizeiptr length, const MapAc
/** @todo Enable also in Emscripten (?) when extension wrangler is available */
#ifdef CORRADE_TARGET_NACL
CORRADE_ASSERT(!_mappedBuffer, "Buffer::mapSub(): the buffer is already mapped", nullptr);
return _mappedBuffer = glMapBufferSubDataCHROMIUM(static_cast<GLenum>(bindInternal(_targetHint)), offset, length, GLenum(access));
return _mappedBuffer = glMapBufferSubDataCHROMIUM(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access));
#else
CORRADE_INTERNAL_ASSERT(false);
static_cast<void>(offset);
@ -228,7 +228,7 @@ void Buffer::unmapSub() {
#ifndef MAGNUM_TARGET_GLES2
void Buffer::copyImplementationDefault(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) {
glCopyBufferSubData(static_cast<GLenum>(read.bindInternal(Target::CopyRead)), static_cast<GLenum>(write.bindInternal(Target::CopyWrite)), readOffset, writeOffset, size);
glCopyBufferSubData(GLenum(read.bindInternal(Target::CopyRead)), GLenum(write.bindInternal(Target::CopyWrite)), readOffset, writeOffset, size);
}
#ifndef MAGNUM_TARGET_GLES
@ -259,17 +259,17 @@ void Buffer::getSubDataImplementationDSA(const GLintptr offset, const GLsizeiptr
#endif
void Buffer::dataImplementationDefault(GLsizeiptr size, const GLvoid* data, Buffer::Usage usage) {
glBufferData(static_cast<GLenum>(bindInternal(_targetHint)), size, data, static_cast<GLenum>(usage));
glBufferData(GLenum(bindInternal(_targetHint)), size, data, GLenum(usage));
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::dataImplementationDSA(GLsizeiptr size, const GLvoid* data, Buffer::Usage usage) {
glNamedBufferDataEXT(_id, size, data, static_cast<GLenum>(usage));
glNamedBufferDataEXT(_id, size, data, GLenum(usage));
}
#endif
void Buffer::subDataImplementationDefault(GLintptr offset, GLsizeiptr size, const GLvoid* data) {
glBufferSubData(static_cast<GLenum>(bindInternal(_targetHint)), offset, size, data);
glBufferSubData(GLenum(bindInternal(_targetHint)), offset, size, data);
}
#ifndef MAGNUM_TARGET_GLES
@ -298,7 +298,7 @@ void Buffer::invalidateSubImplementationARB(GLintptr offset, GLsizeiptr length)
void* Buffer::mapImplementationDefault(MapAccess access) {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES
return glMapBuffer(static_cast<GLenum>(bindInternal(_targetHint)), GLenum(access));
return glMapBuffer(GLenum(bindInternal(_targetHint)), GLenum(access));
#else
static_cast<void>(access);
return nullptr;
@ -315,7 +315,7 @@ void* Buffer::mapImplementationDSA(MapAccess access) {
void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length, MapFlags access) {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2
return glMapBufferRange(static_cast<GLenum>(bindInternal(_targetHint)), offset, length, GLenum(access));
return glMapBufferRange(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access));
#else
static_cast<void>(offset);
static_cast<void>(length);
@ -333,7 +333,7 @@ void* Buffer::mapRangeImplementationDSA(GLintptr offset, GLsizeiptr length, MapF
void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr length) {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glFlushMappedBufferRange(static_cast<GLenum>(bindInternal(_targetHint)), offset, length);
glFlushMappedBufferRange(GLenum(bindInternal(_targetHint)), offset, length);
#else
static_cast<void>(offset);
static_cast<void>(length);
@ -349,7 +349,7 @@ void Buffer::flushMappedRangeImplementationDSA(GLintptr offset, GLsizeiptr lengt
bool Buffer::unmapImplementationDefault() {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2
return glUnmapBuffer(static_cast<GLenum>(bindInternal(_targetHint)));
return glUnmapBuffer(GLenum(bindInternal(_targetHint)));
#else
return false;
#endif

10
src/CubeMapTexture.h

@ -116,7 +116,7 @@ class CubeMapTexture: public AbstractTexture {
* @requires_gl %Texture image queries are not available in OpenGL ES.
*/
Vector2i imageSize(Coordinate coordinate, Int level) {
return DataHelper<2>::imageSize(this, static_cast<GLenum>(coordinate), level);
return DataHelper<2>::imageSize(this, GLenum(coordinate), level);
}
#endif
@ -171,14 +171,14 @@ class CubeMapTexture: public AbstractTexture {
* See Texture::setImage() for more information.
*/
CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, const ImageReference2D& image) {
DataHelper<2>::setImage(this, static_cast<GLenum>(coordinate), level, internalFormat, image);
DataHelper<2>::setImage(this, GLenum(coordinate), level, internalFormat, image);
return *this;
}
#ifndef MAGNUM_TARGET_GLES2
/** @overload */
CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) {
DataHelper<2>::setImage(this, static_cast<GLenum>(coordinate), level, internalFormat, image);
DataHelper<2>::setImage(this, GLenum(coordinate), level, internalFormat, image);
return *this;
}
#endif
@ -194,14 +194,14 @@ class CubeMapTexture: public AbstractTexture {
* See Texture::setSubImage() for more information.
*/
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const ImageReference2D& image) {
DataHelper<2>::setSubImage(this, static_cast<GLenum>(coordinate), level, offset, image);
DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image);
return *this;
}
#ifndef MAGNUM_TARGET_GLES2
/** @overload */
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image) {
DataHelper<2>::setSubImage(this, static_cast<GLenum>(coordinate), level, offset, image);
DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image);
return *this;
}
#endif

2
src/CubeMapTextureArray.h

@ -118,7 +118,7 @@ class CubeMapTextureArray: public AbstractTexture {
* See Texture::imageSize() for more information.
*/
Vector3i imageSize(Coordinate coordinate, Int level) {
return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_POSITIVE_X + static_cast<GLenum>(coordinate), level);
return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_POSITIVE_X + GLenum(coordinate), level);
}
/**

2
src/DefaultFramebuffer.cpp

@ -48,7 +48,7 @@ DefaultFramebuffer& DefaultFramebuffer::mapForDraw(std::initializer_list<std::pa
GLenum* _attachments = new GLenum[max+1];
std::fill_n(_attachments, max, GL_NONE);
for(const auto& attachment: attachments)
_attachments[attachment.first] = static_cast<GLenum>(attachment.second);
_attachments[attachment.first] = GLenum(attachment.second);
(this->*drawBuffersImplementation)(max+1, _attachments);
delete[] _attachments;

4
src/DefaultFramebuffer.h

@ -349,7 +349,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
* available only in OpenGL ES 3.0.
*/
DefaultFramebuffer& mapForDraw(DrawAttachment attachment) {
(this->*drawBufferImplementation)(static_cast<GLenum>(attachment));
(this->*drawBufferImplementation)(GLenum(attachment));
return *this;
}
#endif
@ -367,7 +367,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer {
* @requires_gles30 %Extension @es_extension2{NV,read_buffer,GL_NV_read_buffer}
*/
DefaultFramebuffer& mapForRead(ReadAttachment attachment) {
(this->*readBufferImplementation)(static_cast<GLenum>(attachment));
(this->*readBufferImplementation)(GLenum(attachment));
return *this;
}

4
src/Framebuffer.cpp

@ -157,7 +157,7 @@ void Framebuffer::renderbufferImplementationDSA(BufferAttachment attachment, Ren
}
void Framebuffer::texture1DImplementationDefault(BufferAttachment attachment, Texture1D& texture, GLint mipLevel) {
glFramebufferTexture1D(GLenum(bindInternal()), GLenum(attachment), static_cast<GLenum>(texture.target()), texture.id(), mipLevel);
glFramebufferTexture1D(GLenum(bindInternal()), GLenum(attachment), GLenum(texture.target()), texture.id(), mipLevel);
}
void Framebuffer::texture1DImplementationDSA(BufferAttachment attachment, Texture1D& texture, GLint mipLevel) {
@ -179,7 +179,7 @@ void Framebuffer::texture3DImplementationDefault(BufferAttachment attachment, Te
/** @todo Check for texture target compatibility */
/** @todo Get some extension wrangler for glFramebufferTexture3D() (extension only) */
#ifndef MAGNUM_TARGET_GLES
glFramebufferTexture3D(GLenum(bindInternal()), GLenum(attachment), static_cast<GLenum>(texture.target()), texture.id(), mipLevel, layer);
glFramebufferTexture3D(GLenum(bindInternal()), GLenum(attachment), GLenum(texture.target()), texture.id(), mipLevel, layer);
#else
static_cast<void>(attachment);
static_cast<void>(texture);

6
src/Mesh.cpp

@ -169,17 +169,17 @@ void Mesh::drawInternal(Int firstVertex, Int vertexCount, GLintptr indexOffset,
/* Non-indexed mesh */
if(!indexCount)
glDrawArrays(static_cast<GLenum>(_primitive), firstVertex, vertexCount);
glDrawArrays(GLenum(_primitive), firstVertex, vertexCount);
#ifndef MAGNUM_TARGET_GLES2
/* Indexed mesh with specified range */
else if(indexEnd)
glDrawRangeElements(static_cast<GLenum>(_primitive), indexStart, indexEnd, indexCount, static_cast<GLenum>(_indexType), reinterpret_cast<GLvoid*>(indexOffset));
glDrawRangeElements(GLenum(_primitive), indexStart, indexEnd, indexCount, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexOffset));
#endif
/* Indexed mesh without specified range */
else
glDrawElements(static_cast<GLenum>(_primitive), indexCount, static_cast<GLenum>(_indexType), reinterpret_cast<GLvoid*>(indexOffset));
glDrawElements(GLenum(_primitive), indexCount, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexOffset));
(this->*unbindImplementation)();
}

12
src/Mesh.h

@ -639,8 +639,8 @@ class MAGNUM_EXPORT Mesh {
(this->*attributePointerImplementation)(Attribute{
&buffer,
location+i,
static_cast<GLint>(attribute.components()),
static_cast<GLenum>(attribute.dataType()),
GLint(attribute.components()),
GLenum(attribute.dataType()),
bool(attribute.dataOptions() & AbstractShaderProgram::Attribute<location, T>::DataOption::Normalized),
offset,
stride
@ -652,8 +652,8 @@ class MAGNUM_EXPORT Mesh {
(this->*attributeIPointerImplementation)(IntegerAttribute{
&buffer,
location,
static_cast<GLint>(attribute.components()),
static_cast<GLenum>(attribute.dataType()),
GLint(attribute.components()),
GLenum(attribute.dataType()),
offset,
stride
});
@ -665,8 +665,8 @@ class MAGNUM_EXPORT Mesh {
(this->*attributeLPointerImplementation)(LongAttribute{
&buffer,
location+i,
static_cast<GLint>(attribute.components()),
static_cast<GLenum>(attribute.dataType()),
GLint(attribute.components()),
GLenum(attribute.dataType()),
offset,
stride
});

2
src/Query.h

@ -291,7 +291,7 @@ class SampleQuery: public AbstractQuery {
* @requires_gl Conditional rendering is not available in OpenGL ES.
*/
void beginConditionalRender(ConditionalRenderMode mode) {
glBeginConditionalRender(id(), static_cast<GLenum>(mode));
glBeginConditionalRender(id(), GLenum(mode));
}
/**

2
src/Shader.cpp

@ -534,7 +534,7 @@ Int Shader::maxCombinedUniformComponents(const Type type) {
#endif
Shader::Shader(const Version version, const Type type): _type(type), _id(0) {
_id = glCreateShader(static_cast<GLenum>(_type));
_id = glCreateShader(GLenum(_type));
switch(version) {
#ifndef MAGNUM_TARGET_GLES

2
src/Texture.h

@ -227,7 +227,7 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* Creates one OpenGL texture.
* @see @fn_gl{GenTextures}
*/
explicit Texture(Target target = DataHelper<Dimensions>::target()): AbstractTexture(static_cast<GLenum>(target)) {}
explicit Texture(Target target = DataHelper<Dimensions>::target()): AbstractTexture(GLenum(target)) {}
/** @brief %Texture target */
constexpr Target target() const { return static_cast<Target>(_target); }

Loading…
Cancel
Save