Gorgon Game Engine
Gorgon::GL Namespace Reference

This namespace contains underlying graphics library functions. More...

Namespaces

 TextureUnit
 
 UBOBindingPoint
 

Classes

class  FrameBuffer
 This is a frame buffer object that can be used for render to texture tasks. More...
 
class  QuadTextureCoords
 
class  QuadVertices
 
class  Shader
 

Functions

void Clear ()
 Clears the window pointed by the active context. More...
 
void CopyToTexture (Texture texture, const Containers::Image &data, Geometry::Bounds source, Geometry::Point target)
 Copies the data from the given image to the texture starting from specified boundary of the given target. More...
 
void CopyToTexture (Texture texture, const Containers::Image &data, Geometry::Point target)
 Copies the data from the given image to the texture starting from the given target. More...
 
GLuint CreateShader (GLenum type, const std::string &code, const std::string &name)
 
void debug_proc (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *)
 
void DestroyTexture (Texture texture)
 Destroys the given texture. More...
 
Texture GenerateEmptyTexture (const Geometry::Size &size, Graphics::ColorMode mode)
 This function generates a texture from the given image data. More...
 
Texture GenerateTexture (const Containers::Image &data)
 This function generates a texture from the given image data. More...
 
GLenum getGLColorMode (Graphics::ColorMode mode)
 
void InsertDefines (std::string &code, const std::string &shader_defines)
 
void LoadFunctions ()
 
QuadVertices operator* (const Geometry::Transform3D &transform, const QuadVertices &quad)
 
void RenderToScreen ()
 Stops rendering to a texture and start rendering to a buffer. More...
 
void RenderToTexture (FrameBuffer &buffer)
 Begins using the given frame buffer. More...
 
void Resize (const Geometry::Size &size)
 Resizes the active context. More...
 
void ResizeTexture (Texture texture, const Geometry::Size &size, Graphics::ColorMode mode)
 Resizes the given texture to the specified size. More...
 
void SetDefaultBlending ()
 Sets default blending parameters as current. More...
 
void SetDefaultClear ()
 Sets default clear parameters as current. More...
 
void settexturedata (Texture tex, const Containers::Image &data)
 
void SetupContext (const Geometry::Size &size)
 Performs first time initialization on GL context. More...
 
unsigned int SetupUBO (int size, int binding_point)
 
void UpdateTexture (Texture texture, const Containers::Image &data)
 Updates the given texture to contain the given data. More...
 
void UpdateUBO (unsigned int ubo, int size, void const *const data)
 

Variables

GLuint activeprogram
 
Gorgon::Utils::Logger log
 The logger that is used for GL operations. Default is unset and will not log anything. Use Initialize... to begin logging. More...
 

Detailed Description

This namespace contains underlying graphics library functions.

These functions are presented in a OS/Window manager generic way. However, direct access to GL functions might be necessary in many cases. In those cases you may include GL/OpenGL.h library header. This header might expose operating system dependent headers. In the future there might be more supported GL libraries. In that case, you should choose to include the library you wish to use.

Function Documentation

◆ Clear()

void Clear ( )

Clears the window pointed by the active context.

◆ CopyToTexture() [1/2]

void CopyToTexture ( Texture  texture,
const Containers::Image data,
Geometry::Bounds  source,
Geometry::Point  target 
)

◆ CopyToTexture() [2/2]

void CopyToTexture ( Texture  texture,
const Containers::Image data,
Geometry::Point  target 
)

Copies the data from the given image to the texture starting from the given target.

References getGLColorMode(), basic_Image< T_ >::GetHeight(), basic_Image< T_ >::GetMode(), basic_Image< T_ >::GetWidth(), basic_Image< T_ >::RawData(), basic_Point< T_ >::X, and basic_Point< T_ >::Y.

◆ CreateShader()

GLuint Gorgon::GL::CreateShader ( GLenum  type,
const std::string &  code,
const std::string &  name 
)

◆ debug_proc()

void Gorgon::GL::debug_proc ( GLenum  source,
GLenum  type,
GLuint  id,
GLenum  severity,
GLsizei  length,
const GLchar *  message,
const void *   
)

◆ DestroyTexture()

void DestroyTexture ( Texture  texture)

Destroys the given texture.

◆ GenerateEmptyTexture()

Texture GenerateEmptyTexture ( const Geometry::Size size,
Graphics::ColorMode  mode 
)

This function generates a texture from the given image data.

References getGLColorMode(), basic_Size< T_ >::Height, and basic_Size< T_ >::Width.

◆ GenerateTexture()

Texture GenerateTexture ( const Containers::Image data)

This function generates a texture from the given image data.

References settexturedata().

◆ getGLColorMode()

◆ InsertDefines()

void Gorgon::GL::InsertDefines ( std::string &  code,
const std::string &  shader_defines 
)

◆ LoadFunctions()

◆ operator*()

QuadVertices Gorgon::GL::operator* ( const Geometry::Transform3D transform,
const QuadVertices quad 
)

◆ RenderToScreen()

void RenderToScreen ( )

Stops rendering to a texture and start rendering to a buffer.

References glBindFramebuffer.

◆ RenderToTexture()

void RenderToTexture ( FrameBuffer buffer)

Begins using the given frame buffer.

References FrameBuffer::Use().

◆ Resize()

void Resize ( const Geometry::Size size)

Resizes the active context.

References basic_Size< T_ >::Height, and basic_Size< T_ >::Width.

◆ ResizeTexture()

void ResizeTexture ( Texture  texture,
const Geometry::Size size,
Graphics::ColorMode  mode 
)

Resizes the given texture to the specified size.

The data in the texture cannot be trusted after this call.

References getGLColorMode(), basic_Size< T_ >::Height, and basic_Size< T_ >::Width.

◆ SetDefaultBlending()

void SetDefaultBlending ( )

Sets default blending parameters as current.

References glBlendFuncSeparate.

◆ SetDefaultClear()

void SetDefaultClear ( )

Sets default clear parameters as current.

◆ settexturedata()

◆ SetupContext()

void SetupContext ( const Geometry::Size size)

◆ SetupUBO()

unsigned int SetupUBO ( int  size,
int  binding_point 
)

◆ UpdateTexture()

void UpdateTexture ( Texture  texture,
const Containers::Image data 
)

Updates the given texture to contain the given data.

References settexturedata().

◆ UpdateUBO()

void UpdateUBO ( unsigned int  ubo,
int  size,
void const *const  data 
)

References glBindBuffer, and glBufferSubData.

Variable Documentation

◆ activeprogram

GLuint activeprogram

◆ log

The logger that is used for GL operations. Default is unset and will not log anything. Use Initialize... to begin logging.