Browse Source

Framebuffer: ability to specify which polygon facing to cull

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
0bf1b62080
  1. 38
      src/Framebuffer.h

38
src/Framebuffer.h

@ -53,6 +53,20 @@ class MAGNUM_EXPORT Framebuffer {
Framebuffer& operator=(Framebuffer&& other) = delete;
public:
/**
* @brief Affected polygon facing for culling, stencil operations and masks
*
* @see setFaceCullingMode(),
* setStencilFunction(PolygonFacing, StencilFunction, GLint, GLuint),
* setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation),
* setStencilMask(PolygonFacing, GLuint)
*/
enum class PolygonFacing: GLenum {
Front = GL_FRONT, /**< Front-facing polygons */
Back = GL_BACK, /**< Back-facing polygons */
FrontAndBack = GL_FRONT_AND_BACK /**< Front- and back-facing polygons */
};
/** @{ @name Framebuffer features */
/**
@ -100,6 +114,17 @@ class MAGNUM_EXPORT Framebuffer {
enabled ? glEnable(static_cast<GLenum>(feature)) : glDisable(static_cast<GLenum>(feature));
}
/**
* @brief Which polygon facing to cull
*
* Initial value is `PolygonFacing::Back`. If set to both front and
* back, only points and lines are drawn.
* @attention You have to also enable face culling with setFeature().
*/
inline static void setFaceCullingMode(PolygonFacing mode) {
glCullFace(static_cast<GLenum>(mode));
}
/**
* @brief Set viewport size
*
@ -190,19 +215,6 @@ class MAGNUM_EXPORT Framebuffer {
/** @{ @name Stencil operations */
/**
* @brief Affected polygon facing for stencil operations and masks
*
* @see setStencilFunction(PolygonFacing, StencilFunction, GLint, GLuint),
* setStencilOperation(PolygonFacing, StencilOperation, StencilOperation, StencilOperation),
* setStencilMask(PolygonFacing, GLuint)
*/
enum class PolygonFacing: GLenum {
Front = GL_FRONT, /**< Front-facing polygons */
Back = GL_BACK, /**< Back-facing polygons */
FrontAndBack = GL_FRONT_AND_BACK /**< Front- and back-facing polygons */
};
/**
* @brief Stencil function
*

Loading…
Cancel
Save