Browse Source

Documented required OpenGL version for some functionality.

The requirements are cross-referenced to dedicated page, similarly to
TODO and bug lists.

Also updated / improved documentation for some texture / image formats.
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
3f4e28cfca
  1. 9
      Doxyfile
  2. 4
      doc/MainPage.dox
  3. 28
      doc/RequiredExtensions.dox
  4. 20
      src/AbstractImage.h
  5. 8
      src/AbstractShaderProgram.h
  6. 178
      src/AbstractTexture.h
  7. 31
      src/Buffer.h
  8. 2
      src/BufferedTexture.h
  9. 2
      src/CubeMapTexture.h
  10. 33
      src/Framebuffer.h
  11. 11
      src/Mesh.h
  12. 16
      src/Query.h
  13. 2
      src/Renderbuffer.h
  14. 13
      src/Shader.h
  15. 7
      src/Shaders/PhongShader.h
  16. 2
      src/Texture.h

9
Doxyfile

@ -193,7 +193,14 @@ TAB_SIZE = 8
# will result in a user-defined paragraph with heading "Side Effects:". # will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines. # You can put \n's in the value part of an alias to insert newlines.
ALIASES = ALIASES = \
"requires_gl30=@xrefitem RequiresGL30 \"Requires OpenGL 3.0\" \"Functionality requiring OpenGL 3.0\"" \
"requires_gl31=@xrefitem RequiresGL31 \"Requires OpenGL 3.1\" \"Functionality requiring OpenGL 3.1\"" \
"requires_gl32=@xrefitem RequiresGL32 \"Requires OpenGL 3.2\" \"Functionality requiring OpenGL 3.2\"" \
"requires_gl33=@xrefitem RequiresGL33 \"Requires OpenGL 3.3\" \"Functionality requiring OpenGL 3.3\"" \
"requires_gl40=@xrefitem RequiresGL40 \"Requires OpenGL 4.0\" \"Functionality requiring OpenGL 4.0\"" \
"requires_gl41=@xrefitem RequiresGL41 \"Requires OpenGL 4.1\" \"Functionality requiring OpenGL 4.1\"" \
"requires_gl42=@xrefitem RequiresGL42 \"Requires OpenGL 4.2\" \"Functionality requiring OpenGL 4.2\""
# This tag can be used to specify a number of word-keyword mappings (TCL only). # This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding # A mapping has the form "name=value". For example adding

4
doc/MainPage.dox

@ -16,6 +16,10 @@ Features:
Collection of pre-made @ref Primitives "graphic primitives" and Collection of pre-made @ref Primitives "graphic primitives" and
@ref Shaders "shaders" for testing purposes. @ref Shaders "shaders" for testing purposes.
The engine is meant to be run on OpenGL 3 capable hardware, but most of the
functionality is working on OpenGL 2.1 hardware too. See also
@ref RequiredExtensions.
@section BuildingLink Building Magnum @section BuildingLink Building Magnum
Guide @ref Building "how to build Magnum" on different platforms. Guide @ref Building "how to build Magnum" on different platforms.

28
doc/RequiredExtensions.dox

@ -0,0 +1,28 @@
/** @page RequiredExtensions Functionality requiring specific OpenGL version or extensions
The engine is meant to be run on OpenGL 3 capable hardware, but most of the
functionality is working in OpenGL 2.1 hardware too (i.e. integrated Intel
GPUs), unless stated otherwise. Following are lists of functionality requiring
specific OpenGL version. In most cases it is also specified which extension is
required for given functionality, so if given hardware supports required
extension, it doesn't need to have required OpenGL version too (e.g.
`APPLE_vertex_array_object` is supported on Intel GPUs even if they are
capable of OpenGL 2.1 only).
- @subpage RequiresGL30
- @subpage RequiresGL31
- @subpage RequiresGL32
- @subpage RequiresGL33
- @subpage RequiresGL40
- @subpage RequiresGL41
- @subpage RequiresGL42
@page RequiresGL30 Functionality requiring OpenGL 3.0
@page RequiresGL31 Functionality requiring OpenGL 3.1
@page RequiresGL32 Functionality requiring OpenGL 3.2
@page RequiresGL33 Functionality requiring OpenGL 3.3
@page RequiresGL40 Functionality requiring OpenGL 4.0
@page RequiresGL41 Functionality requiring OpenGL 4.1
@page RequiresGL42 Functionality requiring OpenGL 4.2
*/

20
src/AbstractImage.h

@ -67,7 +67,11 @@ class MAGNUM_EXPORT AbstractImage {
/** Stencil index. For framebuffer reading only. */ /** Stencil index. For framebuffer reading only. */
StencilIndex = GL_STENCIL_INDEX, StencilIndex = GL_STENCIL_INDEX,
/** Depth and stencil component. For framebuffer reading only. */ /**
* Depth and stencil component. For framebuffer reading only.
*
* @requires_gl30 Extension <tt>EXT_packed_depth_stencil</tt>
*/
DepthStencil = GL_DEPTH_STENCIL DepthStencil = GL_DEPTH_STENCIL
}; };
@ -80,7 +84,11 @@ class MAGNUM_EXPORT AbstractImage {
UnsignedInt = GL_UNSIGNED_INT, /**< Each component unsigned int */ UnsignedInt = GL_UNSIGNED_INT, /**< Each component unsigned int */
Int = GL_INT, /**< Each component int */ Int = GL_INT, /**< Each component int */
/** Each component half float (16bit). For framebuffer reading only. */ /**
* Each component half float (16bit). For framebuffer reading only.
*
* @requires_gl30 Extension <tt>NV_half_float</tt> / <tt>ARB_half_float_pixel</tt>
*/
HalfFloat = GL_HALF_FLOAT, HalfFloat = GL_HALF_FLOAT,
Float = GL_FLOAT, /**< Each component float (32bit) */ Float = GL_FLOAT, /**< Each component float (32bit) */
@ -160,6 +168,8 @@ class MAGNUM_EXPORT AbstractImage {
/** /**
* Three-component BGR, float, red and green 11bit, blue 10bit, * Three-component BGR, float, red and green 11bit, blue 10bit,
* 32bit total. For framebuffer reading only. * 32bit total. For framebuffer reading only.
*
* @requires_gl30 Extension <tt>EXT_packed_float</tt>
*/ */
B10GR11Float = GL_UNSIGNED_INT_10F_11F_11F_REV, B10GR11Float = GL_UNSIGNED_INT_10F_11F_11F_REV,
@ -167,18 +177,24 @@ class MAGNUM_EXPORT AbstractImage {
* Three-component BGR, unsigned integers with exponent, each * Three-component BGR, unsigned integers with exponent, each
* component 9bit, exponent 5bit, 32bit total. For framebuffer * component 9bit, exponent 5bit, 32bit total. For framebuffer
* reading only. * reading only.
*
* @requires_gl30 Extension <tt>EXT_texture_shared_exponent</tt>
*/ */
Exponent5RGB9 = GL_UNSIGNED_INT_5_9_9_9_REV, Exponent5RGB9 = GL_UNSIGNED_INT_5_9_9_9_REV,
/** /**
* 24bit depth and 8bit stencil component, 32bit total. For * 24bit depth and 8bit stencil component, 32bit total. For
* framebuffer reading only. * framebuffer reading only.
*
* @requires_gl30 Extension <tt>EXT_packed_depth_stencil</tt>
*/ */
Depth24Stencil8 = GL_UNSIGNED_INT_24_8, Depth24Stencil8 = GL_UNSIGNED_INT_24_8,
/** /**
* 32bit float depth component and 8bit stencil component, 64bit * 32bit float depth component and 8bit stencil component, 64bit
* total. For framebuffer reading only. * total. For framebuffer reading only.
*
* @requires_gl30 Extension <tt>ARB_depth_buffer_float</tt>
*/ */
Depth32FloatStencil8 = GL_FLOAT_32_UNSIGNED_INT_24_8_REV Depth32FloatStencil8 = GL_FLOAT_32_UNSIGNED_INT_24_8_REV
}; };

8
src/AbstractShaderProgram.h

@ -154,6 +154,8 @@ class MAGNUM_EXPORT AbstractShaderProgram {
* *
* @note This function should be called between loadShader() calls * @note This function should be called between loadShader() calls
* and link(). * and link().
*
* @requires_gl30 Extension <tt>EXT_gpu_shader4</tt>
*/ */
void bindFragmentDataLocation(GLuint location, const std::string& name); void bindFragmentDataLocation(GLuint location, const std::string& name);
@ -184,7 +186,11 @@ class MAGNUM_EXPORT AbstractShaderProgram {
glUniform1i(location, value); glUniform1i(location, value);
} }
/** @copydoc setUniform(GLint, GLint) */ /**
* @copydoc setUniform(GLint, GLint)
*
* @requires_gl30 Extension <tt>EXT_gpu_shader4</tt>
*/
void setUniform(GLint location, GLuint value) { void setUniform(GLint location, GLuint value) {
glUniform1ui(location, value); glUniform1ui(location, value);
} }

178
src/AbstractTexture.h

@ -116,14 +116,61 @@ class MAGNUM_EXPORT AbstractTexture {
/** @brief Type of data per each component */ /** @brief Type of data per each component */
enum class ComponentType { enum class ComponentType {
UnsignedByte, /**< Unsigned byte (char) */ /**
Byte, /**< Byte (char) */ * (Non-normalized) unsigned byte
UnsignedShort, /**< Unsigned short */ *
Short, /**< Short */ * @requires_gl30 Extension <tt>EXT_texture_integer</tt>
UnsignedInt, /**< Unsigned integer */ */
Int, /**< Integer */ UnsignedByte,
Half, /**< Half float (16 bit) */
Float, /**< Float (32 bit) */ /**
* (Non-normalized) byte
*
* @requires_gl30 Extension <tt>EXT_texture_integer</tt>
*/
Byte,
/**
* (Non-normalized) unsigned short
*
* @requires_gl30 Extension <tt>EXT_texture_integer</tt>
*/
UnsignedShort,
/**
* (Non-normalized) short
*
* @requires_gl30 Extension <tt>EXT_texture_integer</tt>
*/
Short,
/**
* (Non-normalized) unsigned integer
*
* @requires_gl30 Extension <tt>EXT_texture_integer</tt>
*/
UnsignedInt,
/**
* (Non-normalized) integer
*
* @requires_gl30 Extension <tt>EXT_texture_integer</tt>
*/
Int,
/**
* Half float (16 bit)
*
* @requires_gl30 Extension <tt>ARB_texture_float</tt>
*/
Half,
/**
* Float (32 bit)
*
* @requires_gl30 Extension <tt>ARB_texture_float</tt>
*/
Float,
/** /**
* Normalized unsigned byte, i.e. values from range * Normalized unsigned byte, i.e. values from range
@ -134,6 +181,8 @@ class MAGNUM_EXPORT AbstractTexture {
/** /**
* Normalized byte, i.e. values from range * Normalized byte, i.e. values from range
* @f$ [-128; 127] @f$ are converted to range @f$ [0.0; 1.0] @f$. * @f$ [-128; 127] @f$ are converted to range @f$ [0.0; 1.0] @f$.
*
* @requires_gl31 (no extension providing this functionality)
*/ */
NormalizedByte, NormalizedByte,
@ -146,6 +195,8 @@ class MAGNUM_EXPORT AbstractTexture {
/** /**
* Normalized short, i.e. values from range * Normalized short, i.e. values from range
* @f$ [-32768; 32767] @f$ are converted to range @f$ [0.0; 1.0] @f$. * @f$ [-32768; 32767] @f$ are converted to range @f$ [0.0; 1.0] @f$.
*
* @requires_gl31 (no extension providing this functionality)
*/ */
NormalizedShort NormalizedShort
}; };
@ -160,12 +211,16 @@ class MAGNUM_EXPORT AbstractTexture {
/** /**
* One-component (red channel), unsigned normalized, probably * One-component (red channel), unsigned normalized, probably
* 8bit. * 8bit.
*
* @requires_gl30 (no extension providing this functionality)
*/ */
Red = GL_RED, Red = GL_RED,
/** /**
* Two-component (red and green channel), unsigned normalized, * Two-component (red and green channel), unsigned normalized,
* each component probably 8bit, 16bit total. * each component probably 8bit, 16bit total.
*
* @requires_gl30 (no extension providing this functionality)
*/ */
RedGreen = GL_RG, RedGreen = GL_RG,
@ -212,8 +267,10 @@ class MAGNUM_EXPORT AbstractTexture {
RGB10Alpha2 = GL_RGB10_A2, RGB10Alpha2 = GL_RGB10_A2,
/** /**
* Four-component RGBA, unsigned integers, each RGB component * Four-component RGBA, unsigned non-normalized, each RGB
* 10bit, alpha channel 2bit, 32bit total. * component 10bit, alpha channel 2bit, 32bit total.
*
* @requires_gl33 Extension <tt>ARB_texture_rgb10_a2ui</tt>
*/ */
RGB10Alpha2Unsigned = GL_RGB10_A2UI, RGB10Alpha2Unsigned = GL_RGB10_A2UI,
@ -232,6 +289,8 @@ class MAGNUM_EXPORT AbstractTexture {
/** /**
* Three-component RGB, float, red and green 11bit, blue 10bit, * Three-component RGB, float, red and green 11bit, blue 10bit,
* 32bit total. * 32bit total.
*
* @requires_gl30 Extension <tt>EXT_packed_float</tt>
*/ */
RG11B10Float = GL_R11F_G11F_B10F, RG11B10Float = GL_R11F_G11F_B10F,
@ -244,8 +303,10 @@ class MAGNUM_EXPORT AbstractTexture {
#endif #endif
/** /**
* Three-component RGB, unsigned integers with exponent, each * Three-component RGB, unsigned with exponent, each component
* component 9bit, exponent 5bit, 32bit total. * 9bit, exponent 5bit, 32bit total.
*
* @requires_gl30 Extension <tt>EXT_texture_shared_exponent</tt>
*/ */
RGB9Exponent5 = GL_RGB9_E5, RGB9Exponent5 = GL_RGB9_E5,
@ -261,29 +322,61 @@ class MAGNUM_EXPORT AbstractTexture {
/** Compressed RGBA, unsigned normalized. */ /** Compressed RGBA, unsigned normalized. */
CompressedRGBA = GL_COMPRESSED_RGBA, CompressedRGBA = GL_COMPRESSED_RGBA,
/** RTGC compressed red channel, unsigned normalized. */ /**
* RTGC compressed red channel, unsigned normalized.
*
* @requires_gl30 Extension <tt>EXT_texture_compression_rgtc</tt>
*/
CompressedRtgcRed = GL_COMPRESSED_RED_RGTC1, CompressedRtgcRed = GL_COMPRESSED_RED_RGTC1,
/** RTGC compressed red channel, signed normalized. */ /**
* RTGC compressed red channel, signed normalized.
*
* @requires_gl30 Extension <tt>EXT_texture_compression_rgtc</tt>
*/
CompressedRtgcSignedRed = GL_COMPRESSED_SIGNED_RED_RGTC1, CompressedRtgcSignedRed = GL_COMPRESSED_SIGNED_RED_RGTC1,
/** RTGC compressed red and green channel, unsigned normalized. */ /**
* RTGC compressed red and green channel, unsigned normalized.
*
* @requires_gl30 Extension <tt>EXT_texture_compression_rgtc</tt>
*/
CompressedRtgcRedGreen = GL_COMPRESSED_RG_RGTC2, CompressedRtgcRedGreen = GL_COMPRESSED_RG_RGTC2,
/** RTGC compressed red and green channel, signed normalized. */ /**
* RTGC compressed red and green channel, signed normalized.
*
* @requires_gl30 Extension <tt>EXT_texture_compression_rgtc</tt>
*/
CompressedRtgcSignedRedGreen = GL_COMPRESSED_SIGNED_RG_RGTC2, CompressedRtgcSignedRedGreen = GL_COMPRESSED_SIGNED_RG_RGTC2,
#if defined(GL_COMPRESSED_RGBA_BPTC_UNORM) || defined(DOXYGEN_GENERATING_OUTPUT) #if defined(GL_COMPRESSED_RGBA_BPTC_UNORM) || defined(DOXYGEN_GENERATING_OUTPUT)
/** BTPC compressed RGBA, unsigned normalized. */ /**
* BTPC compressed RGBA, unsigned normalized.
*
* @requires_gl42 Extension <tt>ARB_texture_compression_btpc</tt>
*/
CompressedBtpcRGBA = GL_COMPRESSED_RGBA_BPTC_UNORM, CompressedBtpcRGBA = GL_COMPRESSED_RGBA_BPTC_UNORM,
/** BTPC compressed sRGBA, unsigned normalized. */ /**
* BTPC compressed sRGBA, unsigned normalized.
*
* @requires_gl42 Extension <tt>ARB_texture_compression_btpc</tt>
*/
CompressedBtpcSRGBA = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, CompressedBtpcSRGBA = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
/** BTPC compressed RGB, signed float. */ /**
* BTPC compressed RGB, signed float.
*
* @requires_gl42 Extension <tt>ARB_texture_compression_btpc</tt>
*/
CompressedBtpcRGBSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, CompressedBtpcRGBSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT,
/** BTPC compressed RGB, unsigned float. */ /**
* BTPC compressed RGB, unsigned float.
*
* @requires_gl42 Extension <tt>ARB_texture_compression_btpc</tt>
*/
CompressedBtpcRGBUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, CompressedBtpcRGBUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
#endif #endif
@ -299,13 +392,25 @@ class MAGNUM_EXPORT AbstractTexture {
/** 24bit depth component. */ /** 24bit depth component. */
Depth24 = GL_DEPTH_COMPONENT24, Depth24 = GL_DEPTH_COMPONENT24,
/** 32bit float depth component. */ /**
* 32bit float depth component.
*
* @requires_gl30 Extension <tt>ARB_depth_buffer_float</tt>
*/
Depth32Float = GL_DEPTH_COMPONENT32F, Depth32Float = GL_DEPTH_COMPONENT32F,
/** 24bit depth and 8bit stencil component. */ /**
* 24bit depth and 8bit stencil component.
*
* @requires_gl30 Extension <tt>EXT_packed_depth_stencil</tt>
*/
Depth24Stencil8 = GL_DEPTH24_STENCIL8, Depth24Stencil8 = GL_DEPTH24_STENCIL8,
/** 32bit float depth component and 8bit stencil component. */ /**
* 32bit float depth component and 8bit stencil component.
*
* @requires_gl30 Extension <tt>ARB_depth_buffer_float</tt>
*/
Depth32FloatStencil8 = GL_DEPTH32F_STENCIL8 Depth32FloatStencil8 = GL_DEPTH32F_STENCIL8
}; };
@ -420,13 +525,32 @@ class MAGNUM_EXPORT AbstractTexture {
* Each dimension has its own unique subset of these targets. * Each dimension has its own unique subset of these targets.
*/ */
enum class Target: GLenum { enum class Target: GLenum {
Texture1D = GL_TEXTURE_1D, Texture1D = GL_TEXTURE_1D, /**< One-dimensional texture */
Texture2D = GL_TEXTURE_2D, Texture2D = GL_TEXTURE_2D, /**< Two-dimensional texture */
Texture3D = GL_TEXTURE_3D, Texture3D = GL_TEXTURE_3D, /**< Three-dimensional texture */
/**
* Array of one-dimensional textures
*
* @requires_gl30 Extension <tt>EXT_texture_array</tt>
*/
Array1D = GL_TEXTURE_1D_ARRAY, Array1D = GL_TEXTURE_1D_ARRAY,
/**
* Array of two-dimensional textures
*
* @requires_gl30 Extension <tt>EXT_texture_array</tt>
*/
Array2D = GL_TEXTURE_2D_ARRAY, Array2D = GL_TEXTURE_2D_ARRAY,
/**
* Rectangle texture
*
* @requires_gl31 Extension <tt>ARB_texture_rectangle</tt>
*/
Rectangle = GL_TEXTURE_RECTANGLE, Rectangle = GL_TEXTURE_RECTANGLE,
CubeMap = GL_TEXTURE_CUBE_MAP,
CubeMap = GL_TEXTURE_CUBE_MAP /**< Cube map texture */
}; };
/** /**

31
src/Buffer.h

@ -38,10 +38,18 @@ class Buffer {
/** Used for storing vertex attributes. */ /** Used for storing vertex attributes. */
Array = GL_ARRAY_BUFFER, Array = GL_ARRAY_BUFFER,
/** Source for copies. */ /**
* Source for copies.
*
* @requires_gl31 Extension <tt>ARB_copy_buffer</tt>
*/
CopyRead = GL_COPY_READ_BUFFER, CopyRead = GL_COPY_READ_BUFFER,
/** Target for copies. */ /**
* Target for copies.
*
* @requires_gl31 Extension <tt>ARB_copy_buffer</tt>
*/
CopyWrite = GL_COPY_WRITE_BUFFER, CopyWrite = GL_COPY_WRITE_BUFFER,
/** Used for storing vertex indices. */ /** Used for storing vertex indices. */
@ -53,13 +61,26 @@ class Buffer {
/** Target for pixel pack operations. */ /** Target for pixel pack operations. */
PixelPack = GL_PIXEL_PACK_BUFFER, PixelPack = GL_PIXEL_PACK_BUFFER,
/** Source for texel fetches. */ /**
* Source for texel fetches.
*
* @see BufferedTexture
* @requires_gl31 Extension <tt>ARB_texture_buffer_object</tt>
*/
Texture = GL_TEXTURE_BUFFER, Texture = GL_TEXTURE_BUFFER,
/** Target for transform feedback. */ /**
* Target for transform feedback.
*
* @requires_gl30 Extension <tt>EXT_transform_feedback</tt>
*/
TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER, TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER,
/** Used for storing uniforms. */ /**
* Used for storing uniforms.
*
* @requires_gl31 Extension <tt>ARB_uniform_buffer_object</tt>
*/
Uniform = GL_UNIFORM_BUFFER Uniform = GL_UNIFORM_BUFFER
}; };

2
src/BufferedTexture.h

@ -35,6 +35,8 @@ using data setting functions in Buffer itself.
When using buffered texture in the shader, use `samplerBuffer` and fetch the When using buffered texture in the shader, use `samplerBuffer` and fetch the
data using integer coordinates in `texelFetch()`. data using integer coordinates in `texelFetch()`.
@requires_gl31 Extension <tt>ARB_texture_buffer_object</tt>
*/ */
class BufferedTexture { class BufferedTexture {
BufferedTexture(const BufferedTexture& other) = delete; BufferedTexture(const BufferedTexture& other) = delete;

2
src/CubeMapTexture.h

@ -59,6 +59,8 @@ class CubeMapTexture: public Texture2D {
/** /**
* @brief Enable/disable seamless cube map textures * @brief Enable/disable seamless cube map textures
*
* @requires_gl32 Extension <tt>ARB_seamless_cube_map</tt>
*/ */
inline static void setSeamless(bool enabled) { inline static void setSeamless(bool enabled) {
enabled ? glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) : glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS); enabled ? glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) : glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);

33
src/Framebuffer.h

@ -28,6 +28,8 @@ namespace Magnum {
/** /**
@brief %Framebuffer @brief %Framebuffer
@requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
class MAGNUM_EXPORT Framebuffer { class MAGNUM_EXPORT Framebuffer {
Framebuffer(const Framebuffer& other) = delete; Framebuffer(const Framebuffer& other) = delete;
@ -38,8 +40,19 @@ class MAGNUM_EXPORT Framebuffer {
public: public:
/** @brief %Framebuffer target */ /** @brief %Framebuffer target */
enum class Target: GLenum { enum class Target: GLenum {
Read = GL_READ_FRAMEBUFFER, /**< For reading only. */ /**
Draw = GL_DRAW_FRAMEBUFFER, /**< For drawing only. */ * For reading only.
*
* @requires_gl30 Extension <tt>EXT_framebuffer_blit</tt>
*/
Read = GL_READ_FRAMEBUFFER,
/**
* For drawing only.
*
* @requires_gl30 Extension <tt>EXT_framebuffer_blit</tt>
*/
Draw = GL_DRAW_FRAMEBUFFER,
ReadDraw = GL_FRAMEBUFFER /**< For both reading and drawing. */ ReadDraw = GL_FRAMEBUFFER /**< For both reading and drawing. */
}; };
@ -146,6 +159,8 @@ class MAGNUM_EXPORT Framebuffer {
* mapDefaultForDraw() for binding particular framebuffer for reading * mapDefaultForDraw() for binding particular framebuffer for reading
* and drawing. If multiple attachments are specified in mapForDraw() * and drawing. If multiple attachments are specified in mapForDraw()
* / mapDefaultForDraw(), the data are written to each of them. * / mapDefaultForDraw(), the data are written to each of them.
*
* @requires_gl30 Extension <tt>EXT_framebuffer_blit</tt>
*/ */
inline static void blit(const Math::Vector2<GLint>& bottomLeft, const Math::Vector2<GLint>& topRight, const Math::Vector2<GLint>& destinationBottomLeft, const Math::Vector2<GLint>& destinationTopRight, BlitMask blitMask, AbstractTexture::Filter filter) { inline static void blit(const Math::Vector2<GLint>& bottomLeft, const Math::Vector2<GLint>& topRight, const Math::Vector2<GLint>& destinationBottomLeft, const Math::Vector2<GLint>& destinationTopRight, BlitMask blitMask, AbstractTexture::Filter filter) {
glBlitFramebuffer(bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), destinationBottomLeft.x(), destinationBottomLeft.y(), destinationTopRight.x(), destinationTopRight.y(), static_cast<GLbitfield>(blitMask), static_cast<GLenum>(filter)); glBlitFramebuffer(bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), destinationBottomLeft.x(), destinationBottomLeft.y(), destinationTopRight.x(), destinationTopRight.y(), static_cast<GLbitfield>(blitMask), static_cast<GLenum>(filter));
@ -164,6 +179,8 @@ class MAGNUM_EXPORT Framebuffer {
* no interpolation is needed and thus * no interpolation is needed and thus
* AbstractTexture::Filter::NearestNeighbor filtering is used by * AbstractTexture::Filter::NearestNeighbor filtering is used by
* default. * default.
*
* @requires_gl30 Extension <tt>EXT_framebuffer_blit</tt>
*/ */
inline static void blit(const Math::Vector2<GLint>& bottomLeft, const Math::Vector2<GLint>& topRight, BlitMask blitMask) { inline static void blit(const Math::Vector2<GLint>& bottomLeft, const Math::Vector2<GLint>& topRight, BlitMask blitMask) {
glBlitFramebuffer(bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), static_cast<GLbitfield>(blitMask), static_cast<GLenum>(AbstractTexture::Filter::NearestNeighbor)); glBlitFramebuffer(bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), bottomLeft.x(), bottomLeft.y(), topRight.x(), topRight.y(), static_cast<GLbitfield>(blitMask), static_cast<GLenum>(AbstractTexture::Filter::NearestNeighbor));
@ -266,6 +283,8 @@ class MAGNUM_EXPORT Framebuffer {
* @param depthStencilAttachment Depth/stencil attachment * @param depthStencilAttachment Depth/stencil attachment
* @param texture 1D texture * @param texture 1D texture
* @param mipLevel Mip level * @param mipLevel Mip level
*
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachTexture1D(Target target, DepthStencilAttachment depthStencilAttachment, Texture1D* texture, GLint mipLevel) { inline void attachTexture1D(Target target, DepthStencilAttachment depthStencilAttachment, Texture1D* texture, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -280,6 +299,8 @@ class MAGNUM_EXPORT Framebuffer {
* @param colorAttachment Color attachment ID (number between 0 and 15) * @param colorAttachment Color attachment ID (number between 0 and 15)
* @param texture 1D texture * @param texture 1D texture
* @param mipLevel Mip level * @param mipLevel Mip level
*
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachTexture1D(Target target, unsigned int colorAttachment, Texture1D* texture, GLint mipLevel) { inline void attachTexture1D(Target target, unsigned int colorAttachment, Texture1D* texture, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -297,6 +318,7 @@ class MAGNUM_EXPORT Framebuffer {
* should be always 0. * should be always 0.
* *
* @see attachCubeMapTexture() * @see attachCubeMapTexture()
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachTexture2D(Target target, DepthStencilAttachment depthStencilAttachment, Texture2D* texture, GLint mipLevel) { inline void attachTexture2D(Target target, DepthStencilAttachment depthStencilAttachment, Texture2D* texture, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -314,6 +336,7 @@ class MAGNUM_EXPORT Framebuffer {
* should be always 0. * should be always 0.
* *
* @see attachCubeMapTexture() * @see attachCubeMapTexture()
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachTexture2D(Target target, unsigned int colorAttachment, Texture2D* texture, GLint mipLevel) { inline void attachTexture2D(Target target, unsigned int colorAttachment, Texture2D* texture, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -331,6 +354,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param mipLevel Mip level * @param mipLevel Mip level
* *
* @see attachTexture2D() * @see attachTexture2D()
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachCubeMapTexture(Target target, DepthStencilAttachment depthStencilAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) { inline void attachCubeMapTexture(Target target, DepthStencilAttachment depthStencilAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -347,6 +371,7 @@ class MAGNUM_EXPORT Framebuffer {
* @param mipLevel Mip level * @param mipLevel Mip level
* *
* @see attachTexture2D() * @see attachTexture2D()
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachCubeMapTexture(Target target, unsigned int colorAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) { inline void attachCubeMapTexture(Target target, unsigned int colorAttachment, CubeMapTexture* texture, CubeMapTexture::Coordinate coordinate, GLint mipLevel) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -361,6 +386,8 @@ class MAGNUM_EXPORT Framebuffer {
* @param texture 3D texture * @param texture 3D texture
* @param mipLevel Mip level * @param mipLevel Mip level
* @param layer Layer of 2D image within a 3D texture * @param layer Layer of 2D image within a 3D texture
*
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachTexture3D(Target target, DepthStencilAttachment depthStencilAttachment, Texture3D* texture, GLint mipLevel, GLint layer) { inline void attachTexture3D(Target target, DepthStencilAttachment depthStencilAttachment, Texture3D* texture, GLint mipLevel, GLint layer) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */
@ -376,6 +403,8 @@ class MAGNUM_EXPORT Framebuffer {
* @param texture 3D texture * @param texture 3D texture
* @param mipLevel Mip level * @param mipLevel Mip level
* @param layer Layer of 2D image within a 3D texture. * @param layer Layer of 2D image within a 3D texture.
*
* @requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
inline void attachTexture3D(Target target, unsigned int colorAttachment, Texture3D* texture, GLint mipLevel, GLint layer) { inline void attachTexture3D(Target target, unsigned int colorAttachment, Texture3D* texture, GLint mipLevel, GLint layer) {
/** @todo Check for internal format compatibility */ /** @todo Check for internal format compatibility */

11
src/Mesh.h

@ -31,10 +31,13 @@ namespace Magnum {
class Buffer; class Buffer;
/** /**
* @brief Base class for managing non-indexed meshes @brief Base class for managing non-indexed meshes
*
* @todo Support for normalized values (e.g. for color as char[4] passed to @todo Support for normalized values (e.g. for color as char[4] passed to
* shader as floating-point vec4) shader as floating-point vec4)
@requires_gl30 Extension <tt>APPLE_vertex_array_object</tt>
@requires_gl30 Extension <tt>EXT_gpu_shader4</tt> (for unsigned integer attributes)
*/ */
class MAGNUM_EXPORT Mesh { class MAGNUM_EXPORT Mesh {
Mesh(const Mesh& other) = delete; Mesh(const Mesh& other) = delete;

16
src/Query.h

@ -56,6 +56,8 @@ class MAGNUM_EXPORT AbstractQuery {
* *
* Note that this function is blocking until the result is available. * Note that this function is blocking until the result is available.
* See resultAvailable(). * See resultAvailable().
*
* @requires_gl33 Extension <tt>ARB_timer_query</tt> (64bit integers)
*/ */
template<class T> T result() = delete; template<class T> T result() = delete;
@ -105,7 +107,11 @@ class MAGNUM_EXPORT Query: public AbstractQuery {
/** Count of primitives written to transform feedback buffer. */ /** Count of primitives written to transform feedback buffer. */
TransformFeedbackPrimitivesWritten = GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, TransformFeedbackPrimitivesWritten = GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
/** Elapsed time */ /**
* Elapsed time
*
* @requires_gl33 Extension <tt>ARB_timer_query</tt>
*/
TimeElapsed = GL_TIME_ELAPSED TimeElapsed = GL_TIME_ELAPSED
}; };
@ -173,7 +179,11 @@ class MAGNUM_EXPORT SampleQuery: public AbstractQuery {
/** Count of samples passed from fragment shader */ /** Count of samples passed from fragment shader */
SamplesPassed = GL_SAMPLES_PASSED, SamplesPassed = GL_SAMPLES_PASSED,
/** Whether any samples passed from fragment shader */ /**
* Whether any samples passed from fragment shader
*
* @requires_gl33 Extension <tt>ARB_occlusion_query2</tt>
*/
AnySamplesPassed = GL_ANY_SAMPLES_PASSED AnySamplesPassed = GL_ANY_SAMPLES_PASSED
}; };
@ -258,6 +268,8 @@ GLuint timeElapsed1 = tmp-q1.result<GLuint>();
GLuint timeElapsed2 = q3.result<GLuint>()-tmp; GLuint timeElapsed2 = q3.result<GLuint>()-tmp;
@endcode @endcode
Using this query results in fewer OpenGL calls when doing more measures. Using this query results in fewer OpenGL calls when doing more measures.
@requires_gl33 Extension <tt>ARB_timer_query</tt>
*/ */
class TimeQuery: public AbstractQuery { class TimeQuery: public AbstractQuery {
public: public:

2
src/Renderbuffer.h

@ -27,6 +27,8 @@ namespace Magnum {
@brief %Renderbuffer @brief %Renderbuffer
Attachable to Framebuffer as render target. Attachable to Framebuffer as render target.
@requires_gl30 Extension <tt>EXT_framebuffer_object</tt>
*/ */
class Renderbuffer { class Renderbuffer {
Renderbuffer(const Renderbuffer& other) = delete; Renderbuffer(const Renderbuffer& other) = delete;

13
src/Shader.h

@ -42,9 +42,16 @@ class MAGNUM_EXPORT Shader {
public: public:
/** @brief %Shader type */ /** @brief %Shader type */
enum Type { enum Type {
Vertex = GL_VERTEX_SHADER, /**< @brief Vertex shader */ Vertex = GL_VERTEX_SHADER, /**< Vertex shader */
Geometry = GL_GEOMETRY_SHADER, /**< @brief Geometry shader */
Fragment = GL_FRAGMENT_SHADER /**< @brief Fragment shader */ /**
* Geometry shader
*
* @requires_gl32 Extension <tt>ARB_geometry_shader4</tt>
*/
Geometry = GL_GEOMETRY_SHADER,
Fragment = GL_FRAGMENT_SHADER /**< Fragment shader */
}; };
/** @brief %Shader state */ /** @brief %Shader state */

7
src/Shaders/PhongShader.h

@ -23,7 +23,12 @@
namespace Magnum { namespace Shaders { namespace Magnum { namespace Shaders {
/** @brief Phong shader */ /**
@brief Phong shader
@requires_gl33 The shader is written in GLSL 3.3, although it should be trivial
to port it to older versions.
*/
class PhongShader: public AbstractShaderProgram { class PhongShader: public AbstractShaderProgram {
public: public:
typedef Attribute<0, Vector4> Vertex; /**< @brief Vertex position */ typedef Attribute<0, Vector4> Vertex; /**< @brief Vertex position */

2
src/Texture.h

@ -47,6 +47,8 @@ between 0 and `textureSizeInGivenDirection-1`. Note that rectangle textures
don't support mipmapping and repeating wrapping modes, see @ref Texture::Filter don't support mipmapping and repeating wrapping modes, see @ref Texture::Filter
"Filter", @ref Texture::Mipmap "Mipmap" and generateMipmap() documentation "Filter", @ref Texture::Mipmap "Mipmap" and generateMipmap() documentation
for more information. for more information.
@requires_gl31 Extension <tt>ARB_texture_rectangle</tt> (rectangle textures)
*/ */
template<size_t textureDimensions> class Texture: public AbstractTexture { template<size_t textureDimensions> class Texture: public AbstractTexture {
public: public:

Loading…
Cancel
Save