Urho 1.0.0.0 Urho.UrhoObject Graphics subsystem. Manages the application window, rendering state and GPU resources. Graphics implements the low-level functionality: Creating the window and the rendering context. Setting the screen mode. Keeping track of GPU resources. Keeping track of rendering context state (current rendertarget, vertex and index buffers, textures, shaders and renderstates) Loading shaders. Performing primitive rendering operations. Handling disconnected GPUs. The screen resolution, fullscreen or windowed mode, vertical sync and hardware multisampling level are all set at once by calling When setting the initial screen mode, Graphics does a few checks: For Direct3D9, shader model 3.0 support is checked. For OpenGL, version 3.2 support is checked for first and used if available. As a fallback, version 2.0 with EXT_framebuffer_object, EXT_packed_depth_stencil and EXT_texture_filter_anisotropic extensions is checked for. The ARB_instanced_arrays extension is also checked for but not required; it will enable hardware instancing support when present. Are hardware shadow maps supported? Both AMD & NVIDIA style shadow maps can be used. If neither are available, no shadows will be rendered. Are light pre-pass and deferred rendering modes supported? These require sufficient multiple rendertarget support, and R32F texture format support. The actual rendering of 3D views is driven by the  class.

Dealing with GPU Disconnetion

On Direct3D9 and Android OpenGL ES 2.0 it is possible to lose the rendering context (and therefore GPU resources) due to the application window being minimized or sent to the background.  

Additionally, to work around possible GPU driver bugs the desktop OpenGL context will be voluntarily destroyed and recreated when changing screen mode or toggling between fullscreen and windowed. Therefore, on all graphics APIs one must be prepared for losing GPU resources.

Textures that have been loaded from a file, as well as vertex & index buffers that have shadowing enabled will restore their contents automatically, the rest have to be restored manually. On Direct3D9 non-dynamic (managed) textures and buffers will never be lost, as the runtime automatically backs them up to system memory.

Shader Parameters

You can set parameters for the shaders by calling one of the M:Urho.Graphics.SetShaderParameter methods in this class.  In addition to controlling the shader parameters for your own shaders, you can use this to set the parameters for the various built-in shaders.

Some of the parameters that you can set for the built-in shaders are:

VSP
  • AmbientStartColor
  • AmbientEndColor
  • BillboardRot
  • CameraPos
  • ClipPlane
  • NearClip
  • FarClip
  • DepthMode
  • DeltaTime
  • ElapsedTime
  • FrustumSize
  • GBufferOffsets
  • LightDir
  • LightPos
  • NormalOffsetScale
  • Model
  • View
  • ViewInv
  • ViewProj
  • UOffset
  • VOffset
  • Zone
  • LightMatrices
  • SkinMatrices
  • VertexLights
PSP

  • AmbientColor
  • CameraPosPS
  • DeltaTimePS
  • DepthReconstruct
  • ElapsedTimePS
  • FogColor
  • FogParams
  • GBufferInvSize
  • LightColor
  • LightDirPS
  • LightPosPS
  • NormalOffsetScalePS
  • MatDiffColor
  • MatEmissiveColor
  • MatEnvMapColor
  • MatSpecColor
  • NearClipPS
  • FarClipPS
  • ShadowCubeAdjust
  • ShadowDepthFade
  • ShadowIntensity
  • ShadowMapInvSize
  • ShadowSplits
  • LightMatricesPS
  • VSMShadowParams
  • Roughness
  • Metallic
  • Constructor 1.0.0.0 Preserve To be added. To be added. Constructor 1.0.0.0 Preserve Pointer to the raw unmanaged Urho object. Constructs a new instance of Urho.Graphics, given a raw pointer to an unmanaged object This creates a new managed wrapper for the type using the raw pointer to an unmanaged object. Objects that are created in this fashion get registered with the UrhoSharp runtime. This is intended to be used by the UrhoSharp runtime, and is not intended to be used by users. Constructor 1.0.0.0 Preserve To be added. To be added. To be added. Constructor 1.0.0.0 Preserve Pass UrhoObjectFlag.Empty. Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field. This constructor should be invoked by your code if you provide your own constructor that sets the handle field. This essentially circumvents the default path that creates a new object and sets the handle and does not call RegisterObject on the target, you must do this on your own constructor. You would typically chain to this constructor from your own, and then set the handle to the unmanaged object from your code, and then register your object. Method 1.0.0.0 System.Void To be added. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific alpha texture format. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether alpha-to-coverage is enabled. To be added. To be added. Property 1.0.0.0 System.String Return graphics API name. To be added. To be added. Method 1.0.0.0 System.Void To be added. Begin dumping shader variation names to an XML file for precaching. To be added. Method 1.0.0.0 System.Boolean Begin frame rendering. Return true if device available and can render. To be added. To be added. Property 1.0.0.0 Urho.BlendMode Return blending mode. Or Set blending mode. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether window is borderless. To be added. To be added. Method 1.0.0.0 System.Void Clean up too large scratch buffers. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. Clear any or all of rendertarget, depth buffer and stencil buffer. To be added. Method 1.0.0.0 System.Void To be added. Clear remembered shader parameter source group. To be added. Method 1.0.0.0 System.Void Clear remembered shader parameter sources. To be added. Method 1.0.0.0 System.Void Clear remembered transform shader parameter sources. To be added. Method 1.0.0.0 System.Void Close the window. To be added. Property 1.0.0.0 System.Boolean Return whether color write is enabled. Or Set color write on/off. To be added. To be added. Property 1.0.0.0 Urho.CullMode Return hardware culling mode. Or Set hardware culling mode. To be added. To be added. Property 1.0.0.0 System.Int32 Returns the index of the display containing the center of the window on success or a negative error code on failure. To be added. To be added. Property 1.0.0.0 System.UInt32 Return or Set default texture anisotropy level. Called by Renderer before rendering. To be added. To be added. Property 1.0.0.0 Urho.TextureFilterMode Return default texture filtering mode. Or Set default texture filtering mode. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether deferred rendering is supported. To be added. To be added. Property 1.0.0.0 System.Single Return depth constant bias. To be added. To be added. Property 1.0.0.0 System.Single Return depth slope scaled bias. To be added. To be added. Property 1.0.0.0 Urho.RenderSurface Return depth-stencil surface. Or Set depth-stencil surface. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific hardware depth-stencil texture format. To be added. To be added. Property 1.0.0.0 Urho.CompareMode Return depth compare mode. Or Set depth compare. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether depth write is enabled. Or Set depth write on/off. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether device is lost, and can not yet render. To be added. To be added. Property 1.0.0.0 System.Boolean Controls whether the rendering output is dithered.  Default on OpenGL. No effect on Direct3D. Method 1.0.0.0 System.Void To be added. To be added. To be added. Draw non-indexed geometry. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. To be added. Draw indexed geometry. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. To be added. To be added. Draw indexed geometry with vertex index offset. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. To be added. To be added. Draw indexed, instanced geometry. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. To be added. To be added. To be added. Draw indexed, instanced geometry with vertex index offset. To be added. Property 1.0.0.0 System.UInt32 Return dummy color texture format for shadow maps. 0 if not needed, may be nonzero on OS X to work around an Intel driver issue. To be added. To be added. Method 1.0.0.0 System.Void End dumping shader variations names. To be added. Method 1.0.0.0 System.Void End frame rendering and swap buffers. To be added. Property 1.0.0.0 System.IntPtr Return OS-specific external window handle. Null if not in use. Or Set external window handle. Only effective before setting the initial screen mode. On Windows it is necessary to set up OpenGL pixel format manually for the window. To be added. To be added. Property 1.0.0.0 Urho.FillMode Return polygon fill mode. Or Set polygon fill mode. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific single channel 16-bit float texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific single channel 32-bit float texture format. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether the GPU command buffer is flushed each frame. Not yet implemented on OpenGL. Or Set whether to flush the GPU command buffer to prevent multiple frames being queued and uneven frame timesteps. Not yet implemented on OpenGL. To be added. To be added. Method 1.0.0.0 System.Void To be added. Free a CPU-side scratch buffer. To be added. Property 1.0.0.0 System.Boolean Return whether window is fullscreen. To be added. To be added. Method 1.0.0.0 Urho.IntVector2 To be added. To be added. To be added. To be added. Method 1.0.0.0 Urho.Vector3 To be added. To be added. To be added. To be added. Method 1.0.0.0 System.UInt32 To be added. Return the API-specific texture format from a textual description, for example "rgb". To be added. To be added. Method 1.0.0.0 System.UInt32 To be added. Return hardware format for a compressed image format, or 0 if unsupported. To be added. To be added. Method 1.0.0.0 Urho.RenderSurface To be added. Return rendertarget by index. To be added. To be added. Method 1.0.0.0 Urho.ShaderVariation To be added. To be added. To be added. Return a shader variation by name and defines. To be added. To be added. Method 1.0.0.0 Urho.Texture To be added. Return texture by texture unit index. To be added. To be added. Method 1.0.0.0 Urho.TextureUnit To be added. Return texture unit index by name. To be added. To be added. Method 1.0.0.0 System.String To be added. Return texture unit name by index. To be added. To be added. Method 1.0.0.0 Urho.VertexBuffer To be added. Return current vertex buffer by index. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether shadow map depth compare is done in hardware. Always true on OpenGL. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. Check whether a shader parameter exists on the currently set shaders. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. Check whether the current shader program uses a texture unit. To be added. To be added. Property 1.0.0.0 System.Int32 Return window height. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether window is high DPI. To be added. To be added. Property 1.0.0.0 System.UInt32 Return 24-bit shadow map depth texture format, or 0 if not supported. To be added. To be added. Property 1.0.0.0 Urho.GraphicsImpl* Return graphics implementation, which holds the actual API-specific resources. To be added. To be added. Property 1.0.0.0 Urho.IndexBuffer Return index buffer. Or Set index buffer. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether rendering initialized. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether hardware instancing is supported. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether light pre-pass rendering is supported. To be added. To be added. Property 1.0.0.0 System.Boolean Get or Set line antialiasing on/off. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific linear depth texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific luminance alpha texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific luminance texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return maximum number of supported bones for skinning. To be added. To be added. Method 1.0.0.0 System.Void Maximize the Window. To be added. Property 1.0.0.0 System.Boolean Returns true if window is maximized or runs in full screen mode. To be added. To be added. Method 1.0.0.0 System.Void Minimize the Window. To be added. Property 1.0.0.0 System.Int32 Return the current monitor index. Effective on in fullscreen To be added. To be added. Property 1.0.0.0 System.Int32 Return the number of currently connected monitors. To be added. To be added. Property 1.0.0.0 System.Int32 Return multisample mode (1 = no multisampling.) To be added. To be added. Property 1.0.0.0 System.Int32[] To be added. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. To be added. Check whether a shader parameter group needs update. Does not actually check whether parameters exist in the shaders. To be added. To be added. Property 1.0.0.0 System.UInt32 Return number of batches drawn this frame. To be added. To be added. Property 1.0.0.0 System.UInt32 Return number of primitives drawn this frame. To be added. To be added. Method 1.0.0.0 System.Void Window was moved through user interaction.  Called by Input subsystem. Method 1.0.0.0 System.Void React to window resize. To be added. Property 1.0.0.0 System.String Return allowed screen orientations. Or Set allowed screen orientations as a space-separated list of "LandscapeLeft", "LandscapeRight", "Portrait" and "PortraitUpsideDown". Affects currently only iOS platform. To be added. To be added. Property 1.0.0.0 Urho.ShaderVariation Return pixel shader. To be added. To be added. Property 1.0.0.0 Urho.Vector2 Return UV offset required for pixel perfect rendering. To be added. To be added. Method 1.0.0.0 System.Void To be added. Precache shader variations from an XML file generated with BeginDumpShaders(). To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. Method 1.0.0.0 System.Void Raises window if it was minimized. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific readable hardware depth format, or 0 if not supported. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether a readable hardware depth format is available. To be added. To be added. Property 1.0.0.0 System.Int32 Return refresh rate when using vsync in fullscreen To be added. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. Property 1.0.0.0 Urho.IntVector2 Return rendertarget width and height. To be added. To be added. Method 1.0.0.0 System.IntPtr To be added. Reserve a CPU-side scratch buffer. To be added. To be added. Method 1.0.0.0 System.Void Reset depth-stencil surface. To be added. Method 1.0.0.0 System.Void To be added. Reset specific rendertarget. To be added. Method 1.0.0.0 System.Void Reset all rendertargets, depth-stencil surface and viewport. To be added. Property 1.0.0.0 System.Boolean Return whether window is resizable. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. Resolve a multisampled cube texture on itself. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. Resolve a multisampled texture on itself. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. To be added. Resolve multisampled backbuffer to a texture rendertarget. The texture's size should match the viewport size. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RG 16-bit texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RGBA 16-bit texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RGBA 16-bit float texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RGBA 32-bit float texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RGBA texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RGB texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RG 16-bit float texture format. To be added. To be added. Property 1.0.0.0 System.UInt32 Return the API-specific RG 32-bit float texture format. To be added. To be added. Property 1.0.0.0 Urho.IntRect Return scissor rectangle coordinates. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether scissor test is enabled. To be added. To be added. Property 1.0.0.0 System.IntPtr Return pointer to SDL window. To be added. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set blending and alpha-to-coverage modes. Alpha-to-coverage is not supported on Direct3D9. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. Set a custom clipping plane. The plane is specified in world space, but is dependent on the view and projection matrices. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set depth bias. To be added. Method 1.0.0.0 System.Void To be added. Set depth-stencil surface. To be added. Method 1.0.0.0 System.Boolean To be added. To be added. Set screen resolution only. Return true if successful. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set rendertarget. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set rendertarget. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set scissor test. To be added. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Boolean value to set Set shader boolean constant. Method 1.0.0.0 System.Void To be added. To be added. Set shader integer constant. To be added. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Float value to set Set shader float constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Color value to set. Set shader color constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Matrix value to set. Set shader matrix constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Matrix value to set. Set shader matrix constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Vector value to set Set shader 2D vector constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Vector3 value to set. Set shader 3D vector constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Vector4 value to set. Set shader 4D vector constant. Method 1.0.0.0 System.Void Hashcode for one of the parameters to set (see  for a list of built-in shader parameter names) Pointer to an array of floats to set Number of elements in the array. Set shader float constants. Method 1.0.0.0 System.Void To be added. To be added. Set shaders. To be added. Method 1.0.0.0 System.Void To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. Set stencil test. To be added. Method 1.0.0.0 System.Void To be added. Internal use. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set texture. To be added. Method 1.0.0.0 System.Void Dirty texture parameters of all textures (when global settings change.) To be added. Method 1.0.0.0 System.Void To be added. Set vertex buffer. To be added. Method 1.0.0.0 System.Void To be added. Set viewport. To be added. Method 1.0.0.0 System.Void To be added. Set window icon. To be added. Method 1.0.0.0 System.Void To be added. Set window position. To be added. Method 1.0.0.0 System.Void To be added. To be added. Set window position. To be added. Property 1.0.0.0 System.String Return or Set shader cache directory, Direct3D only. This can either be an absolute path or a path within the resource system. To be added. To be added. Property 1.0.0.0 System.UInt32 Return shadow map depth texture format, or 0 if not supported. To be added. To be added. Property 1.0.0.0 Urho.IntVector2 Return window size in pixels. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether the main window is using sRGB conversion on write. Or Set whether the main window uses sRGB conversion on write. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether sRGB conversion on texture sampling is supported. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether sRGB conversion on rendertarget writing is supported. To be added. To be added. Property 1.0.0.0 System.UInt32 Return stencil compare bitmask. To be added. To be added. Property 1.0.0.0 Urho.StencilOp Return stencil operation to do if stencil test fails. To be added. To be added. Property 1.0.0.0 Urho.StencilOp Return stencil operation to do if stencil test passes. To be added. To be added. Property 1.0.0.0 System.UInt32 Return stencil reference value. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether stencil test is enabled. To be added. To be added. Property 1.0.0.0 Urho.CompareMode Return stencil compare mode. To be added. To be added. Property 1.0.0.0 System.UInt32 Return stencil write bitmask. To be added. To be added. Property 1.0.0.0 Urho.StencilOp Return stencil operation to do if depth compare fails. To be added. To be added. Method 1.0.0.0 System.Boolean To be added. Take a screenshot. Return true if successful. To be added. To be added. Method 1.0.0.0 System.Boolean Toggle between full screen and windowed mode. Return true if successful. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether triple buffering is enabled. To be added. To be added. Property 1.0.0.0 Urho.StringHash Urho's type system type. StringHash representing the type for this C# type. This returns the Urho's type and is surfaced for low-level Urho code. Property 1.0.0.0 System.String Urho's low-level type name. Stringified low-level type name. Property 1.0.0.0 System.String Urho's low-level type name, accessible as a static method. Stringified low-level type name. Property 1.0.0.0 Preserve Urho.StringHash Urho's low-level type, accessible as a static method. This returns the Urho's type and is surface for the low-level Urho code. Property 1.0.0.0 System.Boolean Return whether a custom clipping plane is in use. To be added. To be added. Property 1.0.0.0 Urho.ShaderVariation Return vertex shader. To be added. To be added. Property 1.0.0.0 Urho.IntRect Return the viewport coordinates. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether vertical sync is on. To be added. To be added. Property 1.0.0.0 System.Int32 Return window width. To be added. To be added. Property 1.0.0.0 Urho.IntVector2 Return window position. To be added. To be added. Property 1.0.0.0 System.String Return window title. Or Set window title. To be added. To be added.