Viewport.DrawBackground Method

Draws the viewport background.
Protected Friend Overridable Sub DrawBackground( _ 
ByVal context As RenderContextBase, _ 
ByVal reflection As Boolean, _ 
ByVal reflectionIntensity As Single, _ 
ByVal parentColor As Color, _ 
ByVal pickMatrix As Transformation
)
This language is not supported or no code example is available.
internal protected virtual void DrawBackground( 
RenderContextBase context
bool reflection
float reflectionIntensity
Color parentColor
Transformation pickMatrix 
)
This language is not supported or no code example is available.

Parameters

context
RenderContextBase

The render context

reflection
bool

If true, it's drawing the planar reflections (when there are no shaders)

reflectionIntensity
float

THe intensity of the planar reflections

parentColor
Color

The color of the parent

pickMatrix
Transformation

The matrix to restrict the rendering to the given rectangle (important for Environment.RenderToBitmap).

Example
 
The following code fragment demonstrates how to override the DrawBackground() method to draw a custom background.
 class MyViewport : Viewport
 {
       protected override void DrawBackground()
       {
           // Draws standard background
           base.DrawBackground();
 
           // Draws a white rectangle with a margin of 50 pixel from the viewport's border
           gl.Begin(gl.QUADS);
 
           gl.Color3ub(255, 255, 255);
           gl.Vertex2i(50, 50);
           gl.Vertex2i(Width - 50, 50);
           gl.Vertex2i(Width-50, Height -50);
           gl.Vertex2i(50, Height - 50);
 
           gl.End();
       }
 }					
This language is not supported or no code example is available.
 Class MyViewport
     Inherits Viewport
     Protected Overrides Sub DrawBackground()
         ' Draws standard background
         MyBase.DrawBackground()
 
         ' Draws a white rectangle with a margin of 50 pixel from the viewport's border
         gl.Begin(gl.QUADS)
 
         gl.Color3ub(255, 255, 255)
         gl.Vertex2i(50, 50)
         gl.Vertex2i(Width - 50, 50)
         gl.Vertex2i(Width - 50, Height - 50)
         gl.Vertex2i(50, Height - 50)
 
         gl.[End]()
     End Sub
 End Class
 					
This language is not supported or no code example is available.

.NET Framework

Supported in: 4.8

In this article

Definition