|
LightsprintSDK 2021.08.08
|
#include <Texture.h>
Public Member Functions | |
| Texture (rr::RRBuffer *buffer, bool buildMipMaps, bool compress, int magn=GL_LINEAR, int mini=GL_LINEAR, int wrapS=GL_REPEAT, int wrapT=GL_REPEAT) | |
| rr::RRBuffer * | getBuffer () |
| const rr::RRBuffer * | getBuffer () const |
| void | reset (bool buildMipMaps, bool compress, bool scaledAsSRGB) |
| void | bindTexture () const |
| void | copyTextureToBuffer () |
| const GLuint | getId () const |
| ~Texture () | |
Public Member Functions inherited from rr::RRUniformlyAllocated | |
| void * | operator new (std::size_t n) |
| void * | operator new[] (std::size_t n) |
| void | operator delete (void *p, std::size_t n) |
| void | operator delete[] (void *p, std::size_t n) |
Static Public Member Functions | |
| static Texture * | createShadowmap (unsigned width, unsigned height, bool color=false) |
Public Attributes | |
| unsigned | version |
Protected Attributes | |
| rr::RRBuffer * | buffer |
| GLuint | id |
| GLenum | cubeOr2d |
| GLenum | internalFormat |
Friends | |
| class | FBO |
Additional Inherited Members | |
Protected Member Functions inherited from rr::RRUniformlyAllocatedNonCopyable | |
| RRUniformlyAllocatedNonCopyable () | |
| ~RRUniformlyAllocatedNonCopyable () | |
Texture is simple OpenGL wrapper around rr::RRBuffer.
It supports BT_2D_TEXTURE and BT_CUBE_TEXTURE buffer types. It can be constructed and destructed manually (use one of constructor) or automatically by getTexture() function.
| rr_gl::Texture::Texture | ( | rr::RRBuffer * | buffer, |
| bool | buildMipMaps, | ||
| bool | compress, | ||
| int | magn = GL_LINEAR, |
||
| int | mini = GL_LINEAR, |
||
| int | wrapS = GL_REPEAT, |
||
| int | wrapT = GL_REPEAT |
||
| ) |
Creates texture. Buffer is not adopted, not deleted in destructor.
| rr_gl::Texture::~Texture | ( | ) |
|
static |
Creates shadowmap, depth or color texture.
| rr::RRBuffer * rr_gl::Texture::getBuffer | ( | ) |
Returns texture buffer (with type, width, height, format, data).
| const rr::RRBuffer * rr_gl::Texture::getBuffer | ( | ) | const |
Returns texture buffer (with type, width, height, format, data).
| void rr_gl::Texture::reset | ( | bool | buildMipMaps, |
| bool | compress, | ||
| bool | scaledAsSRGB | ||
| ) |
Rebuilds texture from buffer and additional parameters.
Note that depth textures are automatically configured for the most common use case - shadowmapping. If you plan to read depth values from depth texture (instead of shadowmapping), call glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); after reset().
| buildMipMaps | Builds texture with mipmaps. |
| compress | Builds compressed texture. |
| scaledAsSRGB | Builds sRGB (rather than RGB) texture for scaled buffers. |
| void rr_gl::Texture::bindTexture | ( | ) | const |
Binds texture.
| void rr_gl::Texture::copyTextureToBuffer | ( | ) |
Reads texture back from GPU memory to buffer, increases version.
|
inline |
Returns OpenGL specific id of texture. Only necessary for passing our textures to third party OpenGL code.
|
friend |
| unsigned rr_gl::Texture::version |
|
protected |
|
protected |
|
protected |
|
protected |