nux-1.14.0
nux::GraphicsEngine Class Reference

Rendering engine class. More...

#include <NuxGraphics/GraphicsEngine.h>

List of all members.

Public Member Functions

 GraphicsEngine (GraphicsDisplay &GlWindow, bool create_rendering_data=true)
void SetContext (int x, int y, int width, int height)
void GetContextSize (int &w, int &h) const
int GetContextWidth () const
int GetContextHeight () const
int GetContextX () const
int GetContextY () const
void GetWindowSize (int &w, int &h) const
int GetWindowWidth () const
int GetWindowHeight () const
BaseTextureLoad2DTextureFile (const char *filename)
BaseTextureLoad2DRectangleTextureFile (const char *filename)
BaseTextureLoad2DTextureFileGenerateAlpha (const char *filename, int red, int green, int blue)
void SetTexture (int TextureUnit, BaseTexture *Texture)
void SetTexture (int TextureUnit, ObjectPtr< IOpenGLBaseTexture > Texture)
void EnableTextureMode (int TextureUnit, int TextureMode)
void DisableTextureMode (int TextureUnit, int TextureMode)
void DisableAllTextureMode (int TextureUnit)
void QRP_1Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > Tex0, TexCoordXForm &texxform, const Color &color0)
void QRP_Pixelate (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform, const Color &c0, int pixel_size)
void QRP_Color (int x, int y, int width, int height, const Color &c0)
void QRP_Color (int x, int y, int width, int height, const Color &c0, const Color &c1, const Color &c2, const Color &c3)
void QRP_ColorModTexAlpha (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform0, const Color &color)
void QRP_2Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1)
void QRP_2TexMod (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1)
void QRP_4Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1, ObjectPtr< IOpenGLBaseTexture > DeviceTexture2, TexCoordXForm &texxform2, const Color &color2, ObjectPtr< IOpenGLBaseTexture > DeviceTexture3, TexCoordXForm &texxform3, const Color &color3)
void QRP_Triangle (int x0, int y0, int x1, int y1, int x2, int y2, Color c0)
void QRP_Triangle (int x0, int y0, int x1, int y1, int x2, int y2, Color c0, Color c1, Color c2)
void QRP_Line (int x0, int y0, int x1, int y1, Color c0)
void QRP_Line (int x0, int y0, int x1, int y1, Color c0, Color c1)
void QRP_QuadWireframe (int x0, int y0, int width, int height, Color c0, Color c1, Color c2, Color c3)
ObjectPtr< IOpenGLBaseTextureQRP_GetBlurTexture (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f, int num_pass=1)
ObjectPtr< IOpenGLBaseTextureQRP_GetAlphaTexture (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
ObjectPtr< IOpenGLBaseTextureQRP_GetColorMatrixTexture (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, Matrix4 color_matrix, Vector4 offset)
ObjectPtr< IOpenGLBaseTextureQRP_GetPower (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, const Vector4 &exponent)
ObjectPtr< IOpenGLBaseTextureQRP_GetLQBlur (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
ObjectPtr< IOpenGLBaseTextureQRP_GetHQBlur (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f, int num_pass=1)
void QRP_DisturbedTexture (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > distorsion_texture, TexCoordXForm &texxform0, const Color &c0, ObjectPtr< IOpenGLBaseTexture > src_device_texture, TexCoordXForm &texxform1, const Color &c1)
ObjectPtr< IOpenGLBaseTextureQRP_GetPixelBlocks (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform0, const Color &c0, int pixel_size)
void QRP_GetCopyTexture (int width, int height, ObjectPtr< IOpenGLBaseTexture > &dst_device_texture, ObjectPtr< IOpenGLBaseTexture > &src_device_texture, TexCoordXForm &texxform0, const Color &c0)
void QRP_ASM_1Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > Tex0, TexCoordXForm &texxform, const Color &color0)
void QRP_ASM_Pixelate (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform, const Color &c0, int pixel_size)
void QRP_ASM_Color (int x, int y, int width, int height, const Color &c0)
void QRP_ASM_Color (int x, int y, int width, int height, const Color &c0, const Color &c1, const Color &c2, const Color &c3)
void QRP_ASM_ColorModTexAlpha (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform0, const Color &color)
void QRP_ASM_2Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1)
void QRP_ASM_2TexMod (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1)
void QRP_ASM_4Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1, ObjectPtr< IOpenGLBaseTexture > DeviceTexture2, TexCoordXForm &texxform2, const Color &color2, ObjectPtr< IOpenGLBaseTexture > DeviceTexture3, TexCoordXForm &texxform3, const Color &color3)
void QRP_ASM_Triangle (int x0, int y0, int x1, int y1, int x2, int y2, Color c0)
void QRP_ASM_Triangle (int x0, int y0, int x1, int y1, int x2, int y2, Color c0, Color c1, Color c2)
void QRP_ASM_Line (int x0, int y0, int x1, int y1, Color c0)
void QRP_ASM_Line (int x0, int y0, int x1, int y1, Color c0, Color c1)
void QRP_ASM_QuadWireframe (int x0, int y0, int width, int height, Color c0, Color c1, Color c2, Color c3)
void QRP_ASM_Power (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, Vector4 exponent)
void QRP_ASM_AlphaReplicate (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
void QRP_ASM_HorizontalGauss (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f)
void QRP_ASM_VerticalGauss (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f)
void QRP_ASM_ColorMatrix (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, Matrix4 color_matrix, Vector4 offset)
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetBlurTexture (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &color, float sigma=1.0f, int num_pass=1)
 Blur texture.
void QRP_ASM_GetBlurTextureFx (int x, int y, int buffer_width, int buffer_height, FxStructure *fx_structure, TexCoordXForm &texxform, const Color &color, float sigma=1.0f, int num_pass=1)
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetAlphaTexture (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &color)
 Replicate the alpha channel in all components of the texture.
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetColorMatrixTexture (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c, Matrix4 color_matrix, Vector4 offset)
 Color matrix filter.
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetPower (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, const Vector4 &exponent)
 Texture components raised to a power.
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetLQBlur (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetHQBlur (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f, int num_pass=1)
void QRP_ASM_DisturbedTexture (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > distorsion_texture, TexCoordXForm &texxform0, const Color &c0, ObjectPtr< IOpenGLBaseTexture > src_device_texture, TexCoordXForm &texxform1, const Color &c1)
ObjectPtr< IOpenGLBaseTextureQRP_ASM_GetPixelBlocks (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform0, const Color &color, int pixel_size)
 Pixel blocks.
void QRP_ASM_GetCopyTexture (int width, int height, ObjectPtr< IOpenGLBaseTexture > &dst_device_texture, ObjectPtr< IOpenGLBaseTexture > &src_device_texture, TexCoordXForm &texxform0, const Color &c0)
void QRP_GLSL_1Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform, const Color &c0)
void QRP_GLSL_Pixelate (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform, const Color &c0, int pixel_size)
void QRP_GLSL_Color (int x, int y, int width, int height, const Color &c0)
void QRP_GLSL_Color (int x, int y, int width, int height, const Color &c0, const Color &c1, const Color &c2, const Color &c3)
void QRP_GLSL_ColorModTexAlpha (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture, TexCoordXForm &texxform0, const Color &color)
void QRP_GLSL_2Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1)
void QRP_GLSL_2TexMod (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1)
void QRP_GLSL_4Tex (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > DeviceTexture0, TexCoordXForm &texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > DeviceTexture1, TexCoordXForm &texxform1, const Color &color1, ObjectPtr< IOpenGLBaseTexture > DeviceTexture2, TexCoordXForm &texxform2, const Color &color2, ObjectPtr< IOpenGLBaseTexture > DeviceTexture3, TexCoordXForm &texxform3, const Color &color3)
void QRP_GLSL_Triangle (int x0, int y0, int x1, int y1, int x2, int y2, Color c0)
void QRP_GLSL_Triangle (int x0, int y0, int x1, int y1, int x2, int y2, Color c0, Color c1, Color c2)
void QRP_GLSL_Line (int x0, int y0, int x1, int y1, Color c0)
void QRP_GLSL_Line (int x0, int y0, int x1, int y1, Color c0, Color c1)
void QRP_GLSL_QuadWireframe (int x0, int y0, int width, int height, Color c0, Color c1, Color c2, Color c3)
void QRP_GLSL_Power (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, Vector4 exponent)
void QRP_GLSL_AlphaReplicate (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
void QRP_GLSL_HorizontalGauss (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f)
void QRP_GLSL_VerticalGauss (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f)
void QRP_GLSL_HorizontalHQGauss (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f)
void QRP_GLSL_VerticalHQGauss (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f)
void QRP_GLSL_ColorMatrix (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, Matrix4 color_matrix, Vector4 offset)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetBlurTexture (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f, int num_pass=1)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetAlphaTexture (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetColorMatrixTexture (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, Matrix4 color_matrix, Vector4 offset)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetPower (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, const Vector4 &exponent)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetLQBlur (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetHQBlur (int x, int y, int buffer_width, int buffer_height, ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f, int num_pass=1)
void QRP_GLSL_GetHQBlurFx (int x, int y, int buffer_width, int buffer_height, FxStructure *fx_structure, TexCoordXForm &texxform, const Color &c0, float sigma=1.0f, int num_pass=1)
void QRP_GLSL_DisturbedTexture (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > distorsion_texture, TexCoordXForm &texxform0, const Color &c0, ObjectPtr< IOpenGLBaseTexture > src_device_texture, TexCoordXForm &texxform1, const Color &c1)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetDisturbedTexture (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > distorsion_texture, TexCoordXForm &texxform0, const Color &c0, ObjectPtr< IOpenGLBaseTexture > src_device_texture, TexCoordXForm &texxform1, const Color &c1)
void QRP_GLSL_GetDisturbedTextureFx (int x, int y, int width, int height, ObjectPtr< IOpenGLBaseTexture > distorsion_texture, TexCoordXForm &texxform0, const Color &c0, FxStructure *fx_structure, TexCoordXForm &texxform1, const Color &c1)
ObjectPtr< IOpenGLBaseTextureQRP_GLSL_GetPixelBlocks (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm &texxform0, const Color &c0, int pixel_size)
 Pixel blocks.
void QRP_GLSL_GetCopyTexture (int width, int height, ObjectPtr< IOpenGLBaseTexture > &dst_device_texture, ObjectPtr< IOpenGLBaseTexture > &src_device_texture, TexCoordXForm &texxform0, const Color &c0)
void PushClippingRectangle (Rect rect)
void PopClippingRectangle ()
void EmptyClippingRegion ()
void ApplyClippingRectangle ()
 Set the clipping according to the clipping rectangle stack.
void SetGlobalClippingRectangle (Rect rect)
void DisableGlobalClippingRectangle ()
void SetClippingRectangle (const Rect &rect)
 Bypass the clipping rectangle stack and set a different clipping rectangle region.
void SetOpenGLClippingRectangle (int x, int y, unsigned int width, unsigned int height)
 Bypass the clipping rectangle stack and set a different clipping rectangle region.
Rect GetClippingRegion () const
int GetNumberOfClippingRegions () const
void AddClipOffset (int x, int y)
 Deprecated. Use PushClipOffset.
void PushClipOffset (int x, int y)
void PopClipOffset ()
void ClearAreaColorDepthStencil (int x, int y, int width, int height, Color clearcolor, float cleardepth, int clearstencil)
void ClearAreaColor (int x, int y, int width, int height, Color clearcolor)
void ClearAreaDepthStencil (int x, int y, int width, int height, float cleardepth, int clearstencil)
void Set3DView (int w, int h)
void Push2DWindow (int w, int h)
 Push a screen aligned 2D matrix.
void Pop2DWindow ()
void Push2DModelViewMatrix (Matrix4 mat)
Matrix4 Pop2DModelViewMatrix ()
void Clear2DModelViewMatrix ()
void SetViewport (int x, int y, int w, int h)
Rect GetViewportRect () const
int GetViewportWidth () const
int GetViewportHeight () const
int GetViewportX () const
int GetViewportY () const
void GetViewportSize (int &viewport_width, int &viewport_height) const
void SetScissor (int x, int y, int w, int h)
void SetScissorOffset (int x, int y)
Rect GetScissorRect ()
void EnableScissoring (bool b)
int RenderColorText (ObjectPtr< FontTexture > Font, int x, int y, const NString &Str, const Color &TextColor, bool WriteAlphaChannel, int NumCharacter)
int RenderColorTextLineStatic (ObjectPtr< FontTexture > Font, const PageBBox &pageSize, const NString &Str, const Color &TextColor, bool WriteAlphaChannel, TextAlignment alignment)
int RenderColorTextLineEdit (ObjectPtr< FontTexture > Font, const PageBBox &pageSize, const NString &Str, const Color &TextColor, bool WriteAlphaChannel, const Color &SelectedTextColor, const Color &SelectedTextBackgroundColor, const Color &TextBlinkColor, const Color &CursorColor, bool ShowCursor, unsigned int CursorPosition, int offset=0, int selection_start=0, int selection_end=0)
ObjectPtr< IOpenGLBaseTextureCreateTextureFromBackBuffer (int x, int y, int width, int height)
void ResetStats ()
ObjectPtr< CachedResourceDataCacheResource (ResourceData *Resource)
void UpdateResource (ResourceData *Resource)
bool FlushCachedResourceData (ResourceData *Resource)
bool IsResourceCached (ResourceData *Resource)
Matrix4 GetProjectionMatrix ()
Matrix4 GetOpenGLProjectionMatrix ()
 Return the transpose version of GetProjectionMatrix ();.
void SetProjectionMatrix (const Matrix4 &matrix)
void SetOrthographicProjectionMatrix (int viewport_width, int viewport_height)
 Set orthographic projection matrix.
void ResetProjectionMatrix ()
 Reset the projection matrix to identity.
Matrix4 GetModelViewMatrix ()
Matrix4 GetOpenGLModelViewMatrix ()
 Return the transpose version of GetModelViewMatrix ();.
Matrix4 GetModelViewProjectionMatrix ()
Matrix4 GetOpenGLModelViewProjectionMatrix ()
GpuRenderStatesGetRenderStates ()
void ResetRenderStates ()
void VerifyRenderStates ()
ObjectPtr< FontTextureGetFont ()
ObjectPtr< FontTextureGetBoldFont ()
bool UsingGLSLCodePath ()
 Return True is GraphicsEngine is using the GLSL shader code path.
bool UsingARBProgramCodePath ()
 Return True is GraphicsEngine is using the ARB program code path.
void PushModelViewMatrix (const Matrix4 &matrix)
 Push a model view matrix on the stack.
void PushIdentityModelViewMatrix ()
 Push an Identity model view matrix on the stack.
void Push2DTranslationModelViewMatrix (float tx, float ty, float tz)
 Push a 2D Translation model view matrix.
bool PopModelViewMatrix ()
 Pop a model view matrix off the stack.
void ResetModelViewMatrixStack ()
 Reset the model view matrix to identity.
void SetModelViewMatrix (const Matrix4 &matrix)
 Bypass the model view matrix stack and set a custom matrix.
void ApplyModelViewMatrix ()
 Set the model view matrix according to the model view matrix stack.
Rect ModelViewXFormRect (const Rect &rect)
 Transform a rectangle with the model view matrix.
int ModelViewStackDepth ()
 Return the depth of the model view matrix stack.
void PushProjectionMatrix (const Matrix4 &matrix)
 Push a projection matrix on the stack.
bool PopProjectionMatrix ()
 Pop a projection matrix off the stack.
int ProjectionStackDepth ()
 Return the depth of the projection matrix stack.
void PushPorterDuffBlend (const PorterDuffOperator &porter_duff_op)
 Push a raster operation configuration setting on the stack.
void PushDisableBlend ()
 Push a state that disables the blending.
void PushBlend (unsigned int src_blend, unsigned int dst_blend)
 Push a custom blend state.
bool PopBlend ()
 Pop a raster operation configuration setting off the stack.
int BlendStackDepth ()
 Return the depth of the raster operation stack.

Public Attributes

OpenGLContext m_CurrrentContext
std::vector< RectClippingRect
std::list< Matrix4m_2DModelViewMatricesStack
NResourceCache ResourceCache

Detailed Description

Rendering engine class.

Definition at line 105 of file GraphicsEngine.h.


Constructor & Destructor Documentation

nux::GraphicsEngine::GraphicsEngine ( GraphicsDisplay GlWindow,
bool  create_rendering_data = true 
)
Parameters:
GlWindowThe graphics window for this rendering engine.
create_rendering_dataIf true, then in GraphicsEngine, the system creates the OpenGL shaders and the font textures for the rendering.

Definition at line 153 of file GraphicsEngine.cpp.

References nux::ObjectPtr< T >::IsNull(), nux::Object::UnReference(), and UsingGLSLCodePath().

    :   _graphics_display (GlWindow)
  {
    _scissor.x = 0;
    _scissor.y = 0;
    _clip_offset_x = 0;
    _clip_offset_y = 0;

    _font_renderer = 0;

    _use_glsl_shaders = false;
    _global_clipping_enabled = false;

    // Evaluate the features provided by the GPU.
    EvaluateGpuCaps ();

    GlWindow.m_GraphicsContext = this;
    ResetStats();

    _projection_matrix.Identity();
    _model_view_matrix.Identity();

    ResourceCache.InitializeResourceFactories();

    m_CurrrentContext.x = 0;
    m_CurrrentContext.y = 0;
    m_CurrrentContext.width = _graphics_display.GetWindowWidth();
    m_CurrrentContext.height = _graphics_display.GetWindowHeight();

    SetViewport (0, 0, _graphics_display.GetWindowWidth(), _graphics_display.GetWindowHeight() );
    SetScissor (0, 0, _graphics_display.GetWindowWidth(), _graphics_display.GetWindowHeight() );
    EnableScissoring (true);


    bool opengl_14_support = true;

    if ((_graphics_display.GetGpuDevice()->GetOpenGLMajorVersion () == 1) &&
      (_graphics_display.GetGpuDevice()->GetOpenGLMinorVersion () < 4))
    {
      // OpenGL version is less than OpenGL 1.4
      opengl_14_support = false;
    }

    if (create_rendering_data)
    {
#ifndef NUX_OPENGLES_20
      if (UsingGLSLCodePath () &&
        _graphics_display.GetGpuDevice()->GetGpuInfo ().Support_ARB_Fragment_Shader () &&
        _graphics_display.GetGpuDevice()->GetGpuInfo ().Support_ARB_Vertex_Shader () &&
        opengl_14_support)
      {
        InitSlColorShader ();
        InitSlTextureShader ();
        InitSlPixelateShader ();
        InitSlColorModTexMaskAlpha ();
        InitSl2TextureAdd ();
        InitSl2TextureMod ();
        InitSl4TextureAdd ();

        InitSLPower ();
        InitSLAlphaReplicate ();
        InitSLHorizontalGaussFilter ();
        InitSLVerticalGaussFilter ();
        InitSLColorMatrixFilter ();

        InitSl2TextureDepRead ();

        InitSLHorizontalHQGaussFilter (1);
        InitSLVerticalHQGaussFilter (1);
      }
      else if (_graphics_display.GetGpuDevice()->GetGpuInfo ().Support_ARB_Fragment_Shader () &&
        _graphics_display.GetGpuDevice()->GetGpuInfo ().Support_ARB_Vertex_Program () &&
        opengl_14_support)
      {
        InitAsmColorShader ();
        InitAsmTextureShader ();
        InitAsmPixelateShader ();
        InitAsmColorModTexMaskAlpha ();
        InitAsm2TextureAdd ();
        InitAsm2TextureMod ();
        InitAsm4TextureAdd ();
        InitAsmBlendModes ();

        InitAsmPower ();
        InitAsmAlphaReplicate ();
        InitAsmSeparableGaussFilter ();
        InitAsmColorMatrixFilter ();

        //InitAsm2TextureDepRead (); // NUXTODO: fix the shader
      }
#else
      InitSlColorShader ();
      InitSlTextureShader ();
      InitSlPixelateShader ();
      InitSlColorModTexMaskAlpha ();
      InitSl2TextureAdd ();
      InitSl2TextureMod ();
      InitSl4TextureAdd ();

      InitSLPower ();
      InitSLAlphaReplicate ();
      InitSLHorizontalGaussFilter ();
      InitSLVerticalGaussFilter ();
      InitSLColorMatrixFilter ();
#endif

#if defined (NUX_OS_WINDOWS)
      if (_normal_font.IsNull())
      {
        FontTexture* fnt = new FontTexture (GNuxGraphicsResources.FindResourceLocation (TEXT ("Fonts/Tahoma_size_8.txt"), true).GetTCharPtr(), NUX_TRACKER_LOCATION);
        _normal_font = ObjectPtr<FontTexture> (fnt);
        fnt->UnReference ();
      }

      if (_bold_font.IsNull())
      {
        FontTexture* fnt = new FontTexture (GNuxGraphicsResources.FindResourceLocation (TEXT ("Fonts/Tahoma_size_8_bold.txt"), true).GetTCharPtr(), NUX_TRACKER_LOCATION);
        _bold_font = ObjectPtr<FontTexture> (fnt);
        fnt->UnReference ();
      }
#else
      if (_normal_font.IsNull())
      {
        FontTexture* fnt = new FontTexture (GNuxGraphicsResources.FindResourceLocation (TEXT ("Fonts/Ubuntu_size_10.txt"), true).GetTCharPtr(), NUX_TRACKER_LOCATION);
        _normal_font = ObjectPtr<FontTexture> (fnt);
        fnt->UnReference ();
      }

      if (_bold_font.IsNull())
      {
        FontTexture* fnt = new FontTexture (GNuxGraphicsResources.FindResourceLocation (TEXT ("Fonts/Ubuntu_size_10_bold.txt"), true).GetTCharPtr(), NUX_TRACKER_LOCATION);
        _bold_font = ObjectPtr<FontTexture> (fnt);
        fnt->UnReference ();
      }
#endif

      GpuInfo& gpu_info = _graphics_display.GetGpuDevice ()->GetGpuInfo ();

      if ((gpu_info.Support_ARB_Vertex_Program () && gpu_info.Support_ARB_Fragment_Program ())
          || (gpu_info.Support_ARB_Vertex_Shader () && gpu_info.Support_ARB_Fragment_Shader ()))
      {
        _font_renderer = new FontRenderer (*this);
      }

      if (gpu_info.Support_EXT_Framebuffer_Object ())
        _offscreen_fbo = _graphics_display.GetGpuDevice()->CreateFrameBufferObject ();

      _offscreen_color_rt0  = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);
      _offscreen_color_rt1  = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);
      _offscreen_color_rt2  = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);
      _offscreen_color_rt3  = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);
    }
  }

Member Function Documentation

int nux::GraphicsEngine::BlendStackDepth ( )

Return the depth of the raster operation stack.

Returns:
The depth of the raster operation stack.

Definition at line 1040 of file GraphicsEngine.cpp.

  {
    return (int) _blend_stack.size ();
  }
ObjectPtr< CachedResourceData > nux::GraphicsEngine::CacheResource ( ResourceData Resource)

Cache a resource if it has previously been cached. If the resource does not contain valid data then the returned value is not valid. Check that the returned hardware resource is valid by calling ObjectPtr<CachedResourceData>.IsValid().

Parameters:
ResourceThe resource to cache.
Returns:
A hardware resource.

Definition at line 1281 of file GraphicsEngine.cpp.

Referenced by nux::CachedMeshBuffer::UpdateResource().

  {
    return ResourceCache.GetCachedResource (Resource);
  }
int nux::GraphicsEngine::ModelViewStackDepth ( )

Return the depth of the model view matrix stack.

Returns:
The depth of the model view matrix stack.

Definition at line 999 of file GraphicsEngine.cpp.

  {
    return (int)_model_view_stack.size ();
  }
Rect nux::GraphicsEngine::ModelViewXFormRect ( const Rect rect)

Transform a rectangle with the model view matrix.

This transformation is only good as long as the model view matrix only contains 2D translations. The output rectangle width and height are the same as the input rectangle.

Parameters:
rectThe rectangle to transform.

Definition at line 991 of file GraphicsEngine.cpp.

  {
    Vector4 v0 (rect.x, rect.y, 0.0f, 1.0f);
    Vector4 v1 = _model_view_matrix * v0;
    Rect r (v1.x, v1.y, rect.width, rect.height);
    return r;
  }
bool nux::GraphicsEngine::PopBlend ( )

Pop a raster operation configuration setting off the stack.

Return True is a matrix was successfully popped. False if there was no matrix to pop.

Definition at line 1024 of file GraphicsEngine.cpp.

  {
    if (_blend_stack.size () == 0)
    {
      GetRenderStates ().SetBlend (false, GL_ONE, GL_ZERO);
      return false;
    }

    _blend_stack.pop_front ();
    
    BlendOperator blend_op = (*_blend_stack.begin ());
    GetRenderStates ().SetBlend (blend_op._enable, blend_op._src_blend, blend_op._dst_blend);

    return true;
  }
bool nux::GraphicsEngine::PopModelViewMatrix ( )

Pop a model view matrix off the stack.

Return True is a matrix was successfully popped. False if there was no matrix to pop.

Definition at line 956 of file GraphicsEngine.cpp.

Referenced by nux::TableCtrl::DrawContent(), nux::Layout::ProcessDraw(), nux::GridVLayout::ProcessDraw(), and nux::GridHLayout::ProcessDraw().

  {
    if (!_model_view_stack.empty())
      _model_view_stack.pop_back();

    if (_model_view_stack.empty())
    {
      _model_view_matrix = Matrix4::IDENTITY ();
      return false;
    }

    _model_view_matrix = _model_view_stack.back();

    return true;
  }
bool nux::GraphicsEngine::PopProjectionMatrix ( )

Pop a projection matrix off the stack.

Return True is a matrix was successfully popped. False if there was no matrix to pop.

int nux::GraphicsEngine::ProjectionStackDepth ( )

Return the depth of the projection matrix stack.

Returns:
The depth of the projection matrix stack.
void nux::GraphicsEngine::Push2DTranslationModelViewMatrix ( float  tx,
float  ty,
float  tz 
)

Push a 2D Translation model view matrix.

This is used by Nux to harmonize quads and lines pixel rendering in OpenGL.

Definition at line 948 of file GraphicsEngine.cpp.

References PushModelViewMatrix().

Referenced by nux::TableCtrl::DrawContent().

  {
    Matrix4 temp;
    temp.Translate (tx, ty, tz);

    PushModelViewMatrix (temp);
  }
void nux::GraphicsEngine::PushBlend ( unsigned int  src_blend,
unsigned int  dst_blend 
)

Push a custom blend state.

Parameters:
src_blendOpenGL source blending mode.
dst_blendOpenGL destination blending mode.
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_ASM_GetAlphaTexture ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform,
const Color &  color 
)

Replicate the alpha channel in all components of the texture.

Parameters:
device_textureSource texture.
texxformTexture transformation parameter.
colorModulation color.
Returns:
Texture with all components set to the alpha value of the source.

Definition at line 2104 of file RenderingPipeAsm.cpp.

References nux::ObjectPtr< T >::IsValid().

  {
    //     _offscreen_color_rt0.Release ();
    //     _offscreen_color_rt1.Release ();
    //     _offscreen_depth_rt0.Release ();
    //     _offscreen_depth_rt1.Release ();

    int quad_width = device_texture->GetWidth ();
    int quad_height = device_texture->GetHeight ();

    ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject ();
    int previous_width = 0;
    int previous_height = 0;
    if (prevFBO.IsValid ())
    {
      previous_width = prevFBO->GetWidth ();
      previous_height = prevFBO->GetHeight ();
    }
    else
    {
      previous_width = _graphics_display.GetWindowWidth ();
      previous_height = _graphics_display.GetWindowHeight ();
    }

    CHECKGL (glClearColor (0, 0, 0, 0));
    _offscreen_color_rt0->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt0->SetFiltering(GL_NEAREST, GL_NEAREST);
    _offscreen_color_rt1->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt1->SetFiltering(GL_NEAREST, GL_NEAREST);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, quad_width, quad_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    QRP_ASM_1Tex(0, 0, quad_width, quad_height, device_texture, texxform, color::White);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt1, _offscreen_depth_rt1, quad_width, quad_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    QRP_ASM_AlphaReplicate(0, 0, quad_width, quad_height, _offscreen_color_rt0, texxform, c0);

    _offscreen_fbo->Deactivate();

    if (prevFBO.IsValid ())
    {
      prevFBO->Activate (true);
      SetViewport(0, 0, previous_width, previous_height);
    }
    else
    {
      SetViewport(0, 0, previous_width, previous_height);
    }

    return _offscreen_color_rt1;
  }
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_ASM_GetBlurTexture ( int  x,
int  y,
int  buffer_width,
int  buffer_height,
ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform,
const Color &  color,
float  sigma = 1.0f,
int  num_pass = 1 
)

Blur texture.

Parameters:
device_textureThe texture that is to be blurred.
texxformTexture transformation of device_texture.
xPosition of the source texture in result buffer.
yPosition of the source texture in result buffer.
buffer_widthWidth of result texture.
buffer_heightHeight of result texture.
sigma

Definition at line 1925 of file RenderingPipeAsm.cpp.

  {
    //     _offscreen_color_rt0.Release ();
    //     _offscreen_color_rt1.Release ();
    //     _offscreen_depth_rt0.Release ();
    //     _offscreen_depth_rt1.Release ();

    int quad_width = device_texture->GetWidth ();
    int quad_height = device_texture->GetHeight ();

    num_pass = Clamp<int> (num_pass, 1, 5);

    ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject ();
    int previous_width = 0;
    int previous_height = 0;
    if (prevFBO.IsValid ())
    {
      previous_width = prevFBO->GetWidth ();
      previous_height = prevFBO->GetHeight ();
    }
    else
    {
      previous_width = _graphics_display.GetWindowWidth ();
      previous_height = _graphics_display.GetWindowHeight ();
    }

    CHECKGL (glClearColor (0, 0, 0, 0));
    _offscreen_color_rt0->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt0->SetFiltering(GL_NEAREST, GL_NEAREST);
    _offscreen_color_rt1->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt1->SetFiltering(GL_NEAREST, GL_NEAREST);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, buffer_width, buffer_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    QRP_ASM_1Tex(x, y, quad_width, quad_height, device_texture, texxform, color::White);

    TexCoordXForm texxform1;
    for (int i = 0; i < num_pass; i++)
    {
      SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt1, _offscreen_depth_rt1, buffer_width, buffer_height);
      glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
      QRP_ASM_HorizontalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt0, texxform1, c0);

      SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, buffer_width, buffer_height);
      glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
      QRP_ASM_VerticalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt1, texxform1, c0);
    }

    _offscreen_fbo->Deactivate();

    if (prevFBO.IsValid ())
    {
      prevFBO->Activate (true);
      SetViewport(0, 0, previous_width, previous_height);
    }
    else
    {
      SetViewport(0, 0, previous_width, previous_height);
    }

    return _offscreen_color_rt0;
  }
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_ASM_GetColorMatrixTexture ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform,
const Color &  c,
Matrix4  color_matrix,
Vector4  offset 
)

Color matrix filter.

Parameters:
device_textureSource texture.
texxformTexture transformation parameter.
cModulation color.
color_matrix4x4 section of the color matrix filter.
offsetLast column of the color matrix filter.
Returns:
Texture resulting from the processing of the source through a color matrix.

Definition at line 2159 of file RenderingPipeAsm.cpp.

References nux::ObjectPtr< T >::IsValid().

  {
    int quad_width = device_texture->GetWidth ();
    int quad_height = device_texture->GetHeight ();

    ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject ();
    int previous_width = 0;
    int previous_height = 0;
    if (prevFBO.IsValid ())
    {
      previous_width = prevFBO->GetWidth ();
      previous_height = prevFBO->GetHeight ();
    }
    else
    {
      previous_width = _graphics_display.GetWindowWidth ();
      previous_height = _graphics_display.GetWindowHeight ();
    }

    CHECKGL (glClearColor (0, 0, 0, 0));
    _offscreen_color_rt0->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt0->SetFiltering(GL_NEAREST, GL_NEAREST);
    _offscreen_color_rt1->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt1->SetFiltering(GL_NEAREST, GL_NEAREST);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, quad_width, quad_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    QRP_ASM_1Tex(0, 0, quad_width, quad_height, device_texture, texxform, color::White);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt1, _offscreen_depth_rt1, quad_width, quad_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    QRP_ASM_ColorMatrix (0, 0, quad_width, quad_height, _offscreen_color_rt0, texxform, c0, color_matrix, offset);

    _offscreen_fbo->Deactivate();

    if (prevFBO.IsValid ())
    {
      prevFBO->Activate (true);
      SetViewport(0, 0, previous_width, previous_height);
    }
    else
    {
      SetViewport(0, 0, previous_width, previous_height);
    }

    return _offscreen_color_rt1;
  }
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_ASM_GetPixelBlocks ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform0,
const Color &  color,
int  pixel_size 
)

Pixel blocks.

Parameters:
device_textureSource texture.
texxformTexture transformation parameter.
colorModulation color.
pixel_sizeSize of pixel blocks.
Returns:
A texture pixelated version of the source texture.

Definition at line 2429 of file RenderingPipeAsm.cpp.

References nux::ObjectPtr< T >::IsValid().

  {
          int quad_width = device_texture->GetWidth ();
          int quad_height = device_texture->GetHeight ();

          ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject ();
          int previous_width = 0;
          int previous_height = 0;
          if (prevFBO.IsValid ())
          {
                  previous_width  = prevFBO->GetWidth ();
                  previous_height = prevFBO->GetHeight ();
          }
          else
          {
                  previous_width  = _graphics_display.GetWindowWidth ();
                  previous_height = _graphics_display.GetWindowHeight ();
          }

    CHECKGL (glClearColor (0, 0, 0, 0));
          SetFrameBufferHelper (_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, quad_width, quad_height);
          CHECKGL (glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
          QRP_ASM_Pixelate (0, 0, quad_width, quad_height, device_texture, texxform0, c0, pixel_size);

          _offscreen_fbo->Deactivate ();

          if (prevFBO.IsValid ())
          {
                  prevFBO->Activate (true);
                  SetViewport (0, 0, previous_width, previous_height);
          }
          else
          {
                  SetViewport (0, 0, previous_width, previous_height);
          }
          return _offscreen_color_rt0;
  }
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_ASM_GetPower ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform,
const Color &  c0,
const Vector4 exponent 
)

Texture components raised to a power.

Each component of the texture is raised to a power provided in the exponent parameter.

Parameters:
device_textureSource texture.
texxformTexture transformation parameter.
cModulation color.
exponentPower values for each component.
Returns:
A texture where the component of the source texture have been raised to a power.

Definition at line 2055 of file RenderingPipeAsm.cpp.

References nux::ObjectPtr< T >::IsValid().

  {
    int quad_width = device_texture->GetWidth ();
    int quad_height = device_texture->GetHeight ();

    ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject ();
    int previous_width = 0;
    int previous_height = 0;
    if (prevFBO.IsValid ())
    {
      previous_width = prevFBO->GetWidth ();
      previous_height = prevFBO->GetHeight ();
    }
    else
    {
      previous_width = _graphics_display.GetWindowWidth ();
      previous_height = _graphics_display.GetWindowHeight ();
    }

    CHECKGL (glClearColor (0, 0, 0, 0));
    _offscreen_color_rt0->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt0->SetFiltering(GL_NEAREST, GL_NEAREST);
    _offscreen_color_rt1->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt1->SetFiltering(GL_NEAREST, GL_NEAREST);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, quad_width, quad_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    QRP_ASM_1Tex(0, 0, quad_width, quad_height, device_texture, texxform, color::White);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt1, _offscreen_depth_rt1, quad_width, quad_height);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    QRP_ASM_Power(0, 0, quad_width, quad_height, _offscreen_color_rt0, texxform, c0, exponent);

    _offscreen_fbo->Deactivate();

    if (prevFBO.IsValid ())
    {
      prevFBO->Activate (true);
      SetViewport(0, 0, previous_width, previous_height);
    }
    else
    {
      SetViewport(0, 0, previous_width, previous_height);
    }

    return _offscreen_color_rt1;
  }
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_GLSL_GetBlurTexture ( int  x,
int  y,
int  buffer_width,
int  buffer_height,
ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform,
const Color &  c0,
float  sigma = 1.0f,
int  num_pass = 1 
)
Parameters:
device_textureThe texture that is to be blurred.
texxformTexture transformation of device_texture.
xPosition of the source texture in result buffer.
yPosition of the source texture in result buffer.
buffer_widthWidth of result texture.
buffer_heightHeight of result texture.

Definition at line 2135 of file RenderingPipeGLSL.cpp.

  {
    int quad_width = device_texture->GetWidth ();
    int quad_height = device_texture->GetHeight ();

    num_pass = Clamp<int> (num_pass, 1, 50);

    ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
    int previous_width = 0;
    int previous_height = 0;
    if (prevFBO.IsValid ())
    {
      previous_width = prevFBO->GetWidth();
      previous_height = prevFBO->GetHeight();
    }
    else
    {
      previous_width = _graphics_display.GetWindowWidth();
      previous_height = _graphics_display.GetWindowHeight();
    }

    CHECKGL (glClearColor(0, 0, 0, 0));
    _offscreen_color_rt0->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt0->SetFiltering(GL_NEAREST, GL_NEAREST);
    _offscreen_color_rt1->SetWrap(GL_CLAMP, GL_CLAMP, GL_CLAMP);
    _offscreen_color_rt1->SetFiltering(GL_NEAREST, GL_NEAREST);

    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, buffer_width, buffer_height);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    QRP_GLSL_1Tex(x, y, quad_width, quad_height, device_texture, texxform, color::White);

    TexCoordXForm texxform1;
    for (int i = 0; i < num_pass; i++)
    {
      SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt1, _offscreen_depth_rt1, buffer_width, buffer_height);
      glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
      QRP_GLSL_HorizontalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt0, texxform1, c0, sigma);

      SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, buffer_width, buffer_height);
      glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
      QRP_GLSL_VerticalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt1, texxform1, c0, sigma);
    }

    _offscreen_fbo->Deactivate();

    if (prevFBO.IsValid ())
    {
      prevFBO->Activate(true);
      SetViewport(0, 0, previous_width, previous_height);
    }
    else
    {
      SetViewport(0, 0, previous_width, previous_height);
    }

    return _offscreen_color_rt0;
  }
ObjectPtr< IOpenGLBaseTexture > nux::GraphicsEngine::QRP_GLSL_GetPixelBlocks ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm texxform0,
const Color &  c0,
int  pixel_size 
)

Pixel blocks.

Parameters:
device_textureSource texture.
texxformTexture transformation parameter.
colorModulation color.
pixel_sizeSize of pixel blocks.
Returns:
A texture pixelated version of the source texture.

Definition at line 2755 of file RenderingPipeGLSL.cpp.

References nux::ObjectPtr< T >::IsValid().

  {
    int quad_width = device_texture->GetWidth ();
    int quad_height = device_texture->GetHeight ();

    ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject ();
    int previous_width = 0;
    int previous_height = 0;
    if (prevFBO.IsValid ())
    {
      previous_width = prevFBO->GetWidth ();
      previous_height = prevFBO->GetHeight ();
    }
    else
    {
      previous_width = _graphics_display.GetWindowWidth ();
      previous_height = _graphics_display.GetWindowHeight ();
    }

    CHECKGL(glClearColor(0, 0, 0, 0));
    SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, quad_width, quad_height);
    CHECKGL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
    QRP_GLSL_Pixelate(0, 0, quad_width, quad_height, device_texture, texxform0, color::White, pixel_size);

    _offscreen_fbo->Deactivate();

    if (prevFBO.IsValid())
    {
      prevFBO->Activate(true);
      SetViewport(0, 0, previous_width, previous_height);
    }
    else
    {
      SetViewport(0, 0, previous_width, previous_height);
    }
    return _offscreen_color_rt0;
  }
void nux::GraphicsEngine::SetClippingRectangle ( const Rect rect)

Bypass the clipping rectangle stack and set a different clipping rectangle region.

You may restore the clipping rectangle stack with ApplyClippingRectangle.

Definition at line 699 of file GraphicsEngine.cpp.

References SetOpenGLClippingRectangle().

  {
    _clipping_rect = rect;
    SetOpenGLClippingRectangle (rect.x, _viewport.height - rect.y - rect.height, rect.width, rect.height);
  }
void nux::GraphicsEngine::SetModelViewMatrix ( const Matrix4 matrix)

Bypass the model view matrix stack and set a custom matrix.

You may restore the view matrix stack by calling ApplyModelViewMatrix.

Definition at line 978 of file GraphicsEngine.cpp.

  {
    _model_view_matrix = matrix;
  }
void nux::GraphicsEngine::SetOrthographicProjectionMatrix ( int  viewport_width,
int  viewport_height 
)

Set orthographic projection matrix.

The default projection matrix used by nux.

Parameters:
viewport_widthViewport width.
viewport_heightViewport height.

Definition at line 1062 of file GraphicsEngine.cpp.

References nux::Matrix4x4< T >::Orthographic().

Referenced by nux::WindowCompositor::RestoreRenderingSurface().

  {
    _projection_matrix.Orthographic (0, viewport_width, viewport_height, 0, -1.0f, 1.0f);
  }
void nux::GraphicsEngine::SetScissorOffset ( int  x,
int  y 
)

When setting a matrix to translate the widgets, the scissor region is not translated accordingly. This function provides a mean to offset the scissor region. It is useful when translating a widget during and overlay drawing. See an example in the code of NUX-01.

Parameters:
xClipping area offset.
yClipping area offset.

Definition at line 1158 of file GraphicsEngine.cpp.

  {
    nuxAssertMsg (0, TEXT("[GraphicsEngine::SetScissorOffset] SetScissorOffset is deprecated."));
//     m_ScissorXOffset = x;
//     m_ScissorYOffset = y;
  }
void nux::GraphicsEngine::UpdateResource ( ResourceData Resource)

Update a resource if it has previously been cached.

Parameters:
ResourceThe resource to cache.

Definition at line 1295 of file GraphicsEngine.cpp.

References nux::ObjectPtr< T >::IsValid(), and nux::NResourceUpdater::UpdatesThisResource().

Referenced by nux::TextureFrameAnimation::Update(), nux::TextureVolume::Update(), nux::TextureCube::Update(), nux::TextureRectangle::Update(), and nux::Texture2D::Update().

  {
    ObjectPtr< CachedResourceData > GLResource = ResourceCache.FindCachedResourceById (Resource->GetResourceIndex() ); //(CachedResourceData*)(*(ResourceCache.ResourceMap.find(Resource->ResourceIndex))).second;

    if (GLResource.IsValid() )
    {
      // Iterate through all resource updater types (list is sorted by subclass depth).
      for (t_u32 i = 0; i < ResourceCache.GetResourceUpdaters().size(); ++i)
      {
        NResourceUpdater *ResourceUpdater = ResourceCache.GetResourceUpdaters() [i];
        nuxAssert (ResourceUpdater);

        // Check if the updater is valid for updating the resource.
        if ( ResourceUpdater->UpdatesThisResource (Resource) )
        {
          ResourceUpdater->UpdateResource(GLResource, Resource);
          break;
        }
      }
    }
  }
bool nux::GraphicsEngine::UsingARBProgramCodePath ( )

Return True is GraphicsEngine is using the ARB program code path.

Returns:
True is the system is using the ARB program code path.

Definition at line 360 of file GraphicsEngine.cpp.

  {
    return !_use_glsl_shaders;
  }
bool nux::GraphicsEngine::UsingGLSLCodePath ( )

Return True is GraphicsEngine is using the GLSL shader code path.

Returns:
True is the system is using the GLSL shader code path.

Definition at line 355 of file GraphicsEngine.cpp.

Referenced by GraphicsEngine().

  {
    return _use_glsl_shaders;
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends