LightsprintSDK 2021.08.08
rr_gl Namespace Reference

Classes

struct  ClipPlanes
 
class  FBO
 
class  FpsCounter
 
class  NamedCounter
 
class  PluginCreateRuntimeParams
 
class  PluginParams
 
class  PluginParamsAccumulation
 
class  PluginParamsBloom
 
class  PluginParamsContours
 
class  PluginParamsCube
 
class  PluginParamsDOF
 
class  PluginParamsFPS
 
class  PluginParamsLensFlare
 
class  PluginParamsOculus
 
class  PluginParamsOpenVR
 
class  PluginParamsPanorama
 
class  PluginParamsScene
 
struct  PluginParamsShared
 
class  PluginParamsShowDDI
 
class  PluginParamsSky
 
class  PluginParamsSSGI
 
class  PluginParamsStereo
 
class  PluginParamsToneMapping
 
class  PluginParamsToneMappingAdjustment
 
class  PluginRuntime
 
class  PreserveFlag
 
class  Program
 
class  RealtimeLight
 
class  Renderer
 
class  RRSolverGL
 
class  Texture
 
class  TextureRenderer
 
struct  ToneParameters
 
class  UberProgram
 
struct  UberProgramSetup
 
class  VRDevice
 

Typedefs

typedef rr::RRVector< RealtimeLight * > RealtimeLights
 

Enumerations

enum  {
  VAA_POSITION = 0 ,
  VAA_NORMAL = 1 ,
  VAA_UV_MATERIAL_DIFFUSE = 2 ,
  VAA_UV_MATERIAL_SPECULAR = 3 ,
  VAA_UV_MATERIAL_EMISSIVE = 4 ,
  VAA_UV_MATERIAL_TRANSPARENT = 5 ,
  VAA_UV_MATERIAL_BUMP = 6 ,
  VAA_UV_UNWRAP = 7 ,
  VAA_UV_FORCED_2D = 8 ,
  VAA_UV_LAST = 8 ,
  VAA_COLOR = 9 ,
  VAA_TANGENT = 10 ,
  VAA_BITANGENT = 11 ,
  VAA_COUNT = 12
}
 
enum  {
  TEX_CODE_2D_MATERIAL_DIFFUSE = 0 ,
  TEX_CODE_2D_MATERIAL_SPECULAR = 1 ,
  TEX_CODE_2D_MATERIAL_TRANSPARENCY = 2 ,
  TEX_CODE_2D_MATERIAL_EMISSIVE = 3 ,
  TEX_CODE_2D_MATERIAL_BUMP = 4 ,
  TEX_CODE_2D_LIGHT_DIRECT = 5 ,
  TEX_CODE_2D_LIGHT_INDIRECT = 6 ,
  TEX_CODE_2D_LIGHT_INDIRECT_MIRROR = 7 ,
  TEX_CODE_CUBE_LIGHT_INDIRECT = 8
}
 

Functions

RR_GL_API VRDevicecreateOculusDevice ()
 
RR_GL_API VRDevicecreateOpenVRDevice ()
 
 DECLARE_PRESERVE_STATE (PreserveViewport, GLint viewport[4], glGetIntegerv(GL_VIEWPORT, viewport), glViewport(viewport[0], viewport[1], viewport[2], viewport[3]))
 
 DECLARE_PRESERVE_STATE (PreserveScissor, GLint scissor[4], glGetIntegerv(GL_SCISSOR_BOX, scissor), glScissor(scissor[0], scissor[1], scissor[2], scissor[3]))
 
 DECLARE_PRESERVE_STATE (PreserveClearColor, GLfloat clearcolor[4], glGetFloatv(GL_COLOR_CLEAR_VALUE, clearcolor), glClearColor(clearcolor[0], clearcolor[1], clearcolor[2], clearcolor[3]))
 
 DECLARE_PRESERVE_STATE (PreserveDepthTest, GLboolean depthTest, depthTest=glIsEnabled(GL_DEPTH_TEST), if(depthTest) glEnable(GL_DEPTH_TEST);else glDisable(GL_DEPTH_TEST))
 
 DECLARE_PRESERVE_STATE (PreserveDepthMask, GLboolean depthMask, glGetBooleanv(GL_DEPTH_WRITEMASK,&depthMask), glDepthMask(depthMask))
 
 DECLARE_PRESERVE_STATE (PreserveColorMask, GLboolean colorMask[4], glGetBooleanv(GL_COLOR_WRITEMASK, colorMask), glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]))
 
 DECLARE_PRESERVE_STATE (PreserveCullFace, GLboolean cullFace, cullFace=glIsEnabled(GL_CULL_FACE), if(cullFace) glEnable(GL_CULL_FACE);else glDisable(GL_CULL_FACE))
 
 DECLARE_PRESERVE_STATE (PreserveCullMode, GLint cullMode, glGetIntegerv(GL_CULL_FACE_MODE,&cullMode), glCullFace(cullMode))
 
 DECLARE_PRESERVE_STATE (PreserveBlend, GLboolean blend, blend=glIsEnabled(GL_BLEND), if(blend) glEnable(GL_BLEND);else glDisable(GL_BLEND))
 
 DECLARE_PRESERVE_STATE (PreserveBlendFunc, GLint src;GLint dst, glGetIntegerv(GL_BLEND_SRC_RGB,&src);glGetIntegerv(GL_BLEND_DST_RGB,&dst), glBlendFunc(src, dst))
 
 DECLARE_PRESERVE_STATE (PreserveFBO, FBO state, state=FBO::getState(), state.restore())
 
 DECLARE_PRESERVE_STATE (PreserveAlphaTest, GLboolean test, test=glIsEnabled(GL_ALPHA_TEST), if(test) glEnable(GL_ALPHA_TEST);else glDisable(GL_ALPHA_TEST))
 
 DECLARE_PRESERVE_STATE (PreserveAlphaFunc, GLint func;GLfloat ref, glGetIntegerv(GL_ALPHA_TEST_FUNC,&func);glGetFloatv(GL_ALPHA_TEST_REF,&ref), glAlphaFunc(func, ref))
 
RR_GL_API const char * initializeGL (bool enableGLStateCaching)
 
RR_GL_API void glEnable (GLenum cap)
 
RR_GL_API void glDisable (GLenum cap)
 
RR_GL_API void glViewport (GLint x, GLint y, GLsizei w, GLsizei h)
 
RR_GL_API void glScissor (GLint x, GLint y, GLsizei w, GLsizei h)
 
RR_GL_API void glCullFace (GLenum mode)
 
RR_GL_API void glActiveTexture (GLenum texture)
 
RR_GL_API void glBindBuffer (GLenum target, GLuint buffer)
 
RR_GL_API void glDepthMask (GLboolean depth)
 
RR_GL_API void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
 
RR_GL_API void glBlendEquation (GLenum equation)
 
RR_GL_API void glBlendFunc (GLenum sfactor, GLenum dfactor)
 
RR_GL_API void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 
RR_GL_API void glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer)
 
RR_GL_API GLboolean glIsEnabled (GLenum cap)
 
RR_GL_API void glGetIntegerv (GLenum pname, GLint *params)
 
RR_GL_API void glGetFloatv (GLenum pname, GLfloat *params)
 
RR_GL_API void glGetBooleanv (GLenum pname, GLboolean *params)
 
RR_GL_API TexturegetTexture (const rr::RRBuffer *buffer, bool buildMipMaps=true, bool compress=true, int magn=GL_LINEAR, int mini=GL_LINEAR, int wrapS=GL_REPEAT, int wrapT=GL_REPEAT)
 
RR_GL_API void deleteAllTextures ()
 
RR_GL_API void readPixelsToBuffer (rr::RRBuffer *buffer, unsigned x=0, unsigned y=0)
 

Detailed Description

LightsprintGL - OpenGL based renderer that displays realtime global illumination.

Typedef Documentation

◆ RealtimeLights

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VAA_POSITION 
VAA_NORMAL 
VAA_UV_MATERIAL_DIFFUSE 
VAA_UV_MATERIAL_SPECULAR 
VAA_UV_MATERIAL_EMISSIVE 
VAA_UV_MATERIAL_TRANSPARENT 
VAA_UV_MATERIAL_BUMP 
VAA_UV_UNWRAP 
VAA_UV_FORCED_2D 
VAA_UV_LAST 
VAA_COLOR 
VAA_TANGENT 
VAA_BITANGENT 
VAA_COUNT 

◆ anonymous enum

anonymous enum
Enumerator
TEX_CODE_2D_MATERIAL_DIFFUSE 

Program::sendTexture() code used by our uberprogram for diffuse map.

TEX_CODE_2D_MATERIAL_SPECULAR 

Program::sendTexture() code used by our uberprogram for specular map.

TEX_CODE_2D_MATERIAL_TRANSPARENCY 

Program::sendTexture() code used by our uberprogram for rgb transparency map.

TEX_CODE_2D_MATERIAL_EMISSIVE 

Program::sendTexture() code used by our uberprogram for emissive map.

TEX_CODE_2D_MATERIAL_BUMP 

Program::sendTexture() code used by our uberprogram for normal map.

TEX_CODE_2D_LIGHT_DIRECT 

Program::sendTexture() code used by our uberprogram for projected light map.

TEX_CODE_2D_LIGHT_INDIRECT 

Program::sendTexture() code used by our uberprogram for lightmap/ambient map/light detail map.

TEX_CODE_2D_LIGHT_INDIRECT_MIRROR 

Program::sendTexture() code used by our uberprogram for mirror map.

TEX_CODE_CUBE_LIGHT_INDIRECT 

Program::sendTexture() code used by our uberprogram for environment map.

Function Documentation

◆ createOculusDevice()

RR_GL_API VRDevice * rr_gl::createOculusDevice ( )

Can be created and deleted repeatedly, but only one at a time.

◆ createOpenVRDevice()

RR_GL_API VRDevice * rr_gl::createOpenVRDevice ( )

Can be created and deleted repeatedly, but only one at a time.

◆ DECLARE_PRESERVE_STATE() [1/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveViewport  ,
GLint  viewport[4],
glGetIntegerv(GL_VIEWPORT, viewport)  ,
glViewport(viewport[0], viewport[1], viewport[2], viewport[3])   
)

◆ DECLARE_PRESERVE_STATE() [2/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveScissor  ,
GLint  scissor[4],
glGetIntegerv(GL_SCISSOR_BOX, scissor)  ,
glScissor(scissor[0], scissor[1], scissor[2], scissor[3])   
)

◆ DECLARE_PRESERVE_STATE() [3/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveClearColor  ,
GLfloat  clearcolor[4],
glGetFloatv(GL_COLOR_CLEAR_VALUE, clearcolor)  ,
glClearColor(clearcolor[0], clearcolor[1], clearcolor[2], clearcolor[3])   
)

◆ DECLARE_PRESERVE_STATE() [4/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveDepthTest  ,
GLboolean  depthTest,
depthTest  = glIsEnabled(GL_DEPTH_TEST),
if(depthTest) glEnable(GL_DEPTH_TEST);else glDisable(GL_DEPTH_TEST)   
)

◆ DECLARE_PRESERVE_STATE() [5/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveDepthMask  ,
GLboolean  depthMask,
glGetBooleanv(GL_DEPTH_WRITEMASK,&depthMask)  ,
glDepthMask(depthMask)   
)

◆ DECLARE_PRESERVE_STATE() [6/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveColorMask  ,
GLboolean  colorMask[4],
glGetBooleanv(GL_COLOR_WRITEMASK, colorMask)  ,
glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3])   
)

◆ DECLARE_PRESERVE_STATE() [7/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveCullFace  ,
GLboolean  cullFace,
cullFace  = glIsEnabled(GL_CULL_FACE),
if(cullFace) glEnable(GL_CULL_FACE);else glDisable(GL_CULL_FACE)   
)

◆ DECLARE_PRESERVE_STATE() [8/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveCullMode  ,
GLint  cullMode,
glGetIntegerv(GL_CULL_FACE_MODE,&cullMode)  ,
glCullFace(cullMode)   
)

◆ DECLARE_PRESERVE_STATE() [9/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveBlend  ,
GLboolean  blend,
blend  = glIsEnabled(GL_BLEND),
if(blend) glEnable(GL_BLEND);else glDisable(GL_BLEND)   
)

◆ DECLARE_PRESERVE_STATE() [10/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveBlendFunc  ,
GLint src;GLint  dst,
glGetIntegerv(GL_BLEND_SRC_RGB,&src);glGetIntegerv(GL_BLEND_DST_RGB,&dst)  ,
glBlendFunc(src, dst)   
)

◆ DECLARE_PRESERVE_STATE() [11/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveFBO  ,
FBO  state,
state  = FBO::getState(),
state.  restore() 
)

◆ DECLARE_PRESERVE_STATE() [12/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveAlphaTest  ,
GLboolean  test,
test  = glIsEnabled(GL_ALPHA_TEST),
if(test) glEnable(GL_ALPHA_TEST);else glDisable(GL_ALPHA_TEST)   
)

◆ DECLARE_PRESERVE_STATE() [13/13]

rr_gl::DECLARE_PRESERVE_STATE ( PreserveAlphaFunc  ,
GLint func;GLfloat  ref,
glGetIntegerv(GL_ALPHA_TEST_FUNC,&func);glGetFloatv(GL_ALPHA_TEST_REF,&ref)  ,
glAlphaFunc(func, ref)   
)

◆ initializeGL()

RR_GL_API const char * rr_gl::initializeGL ( bool  enableGLStateCaching)

Initializes OpenGL to state expected by our renderer.

Initializes glew library and some OpenGL states. Should be called only once, soon after OpenGL context creation.

Parameters
enableGLStateCachingTrue to enable GL state caching. State caching reduces number of GL calls, increasing fps, but it requires you to always call rr_gl::glXxx() instead of glXxx(). If you forget, cached state diverges from real GL state.
Returns
nullptr on success, error message when OpenGL was not initialized properly.

◆ glEnable()

RR_GL_API void rr_gl::glEnable ( GLenum  cap)

◆ glDisable()

RR_GL_API void rr_gl::glDisable ( GLenum  cap)

◆ glViewport()

RR_GL_API void rr_gl::glViewport ( GLint  x,
GLint  y,
GLsizei  w,
GLsizei  h 
)

◆ glScissor()

RR_GL_API void rr_gl::glScissor ( GLint  x,
GLint  y,
GLsizei  w,
GLsizei  h 
)

◆ glCullFace()

RR_GL_API void rr_gl::glCullFace ( GLenum  mode)

◆ glActiveTexture()

RR_GL_API void rr_gl::glActiveTexture ( GLenum  texture)

◆ glBindBuffer()

RR_GL_API void rr_gl::glBindBuffer ( GLenum  target,
GLuint  buffer 
)

◆ glDepthMask()

RR_GL_API void rr_gl::glDepthMask ( GLboolean  depth)

◆ glColorMask()

RR_GL_API void rr_gl::glColorMask ( GLboolean  red,
GLboolean  green,
GLboolean  blue,
GLboolean  alpha 
)

◆ glBlendEquation()

RR_GL_API void rr_gl::glBlendEquation ( GLenum  equation)

◆ glBlendFunc()

RR_GL_API void rr_gl::glBlendFunc ( GLenum  sfactor,
GLenum  dfactor 
)

◆ glClearColor()

RR_GL_API void rr_gl::glClearColor ( GLclampf  red,
GLclampf  green,
GLclampf  blue,
GLclampf  alpha 
)

◆ glVertexAttribPointer()

RR_GL_API void rr_gl::glVertexAttribPointer ( GLuint  index,
GLint  size,
GLenum  type,
GLboolean  normalized,
GLsizei  stride,
const void *  pointer 
)

◆ glIsEnabled()

RR_GL_API GLboolean rr_gl::glIsEnabled ( GLenum  cap)

◆ glGetIntegerv()

RR_GL_API void rr_gl::glGetIntegerv ( GLenum  pname,
GLint *  params 
)

◆ glGetFloatv()

RR_GL_API void rr_gl::glGetFloatv ( GLenum  pname,
GLfloat *  params 
)

◆ glGetBooleanv()

RR_GL_API void rr_gl::glGetBooleanv ( GLenum  pname,
GLboolean *  params 
)

◆ getTexture()

RR_GL_API Texture * rr_gl::getTexture ( const rr::RRBuffer buffer,
bool  buildMipMaps = true,
bool  compress = true,
int  magn = GL_LINEAR,
int  mini = GL_LINEAR,
int  wrapS = GL_REPEAT,
int  wrapT = GL_REPEAT 
)

Converts rr::RRBuffer to Texture so it can be immediately used as a texture in OpenGL.

All textures created by getTexture() are deleted at once by deleteAllTexture(). For textures you want to delete individually, don't use getTexture(), use standard constructor, e.g. "Texture t(...);"

Texture uses buffer's customData, you must not use customData for other purposes.

Parameters beyond buffer are ignored if texture already exists and buffer version did not change. Change buffer version or use Texture::reset() to force texture update. For video textures, call buffer->update() manually, otherwise texture contents doesn't change.

◆ deleteAllTextures()

RR_GL_API void rr_gl::deleteAllTextures ( )

Deletes all textures created by getTexture(). (But you can delete textures one by one as well.)

◆ readPixelsToBuffer()

RR_GL_API void rr_gl::readPixelsToBuffer ( rr::RRBuffer buffer,
unsigned  x = 0,
unsigned  y = 0 
)

Fills entire buffer by reading data from OpenGL memory. Most often this is used to capture screenshot.

This is shortcut for glReadPixels(x,y,...), with parameters set to fill entire buffer. See glReadPixels() for details on what is read, you might need to call glReadBuffer() to select data source. Buffer type must be BT_2D_TEXTURE. Buffer's size and format don't change, data are converted if format differs. Optional x and y parameters let you read rectangle from given offset.