VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties
VisimRenderGL.GLRenderContext Class Reference
Inheritance diagram for VisimRenderGL.GLRenderContext:

List of all members.

## Public Member Functions
override void | Start2DRender ()
| Sets renderer to 2d context, all 2d rendering calls should be done after this call!
override void | Stop2DRender ()
| Returns renderer to previous (3d) rendering state from the 2d renderer.
override void | DrawPoint (int x, int y)
| Draw point in screen coordinates with currently selected color.
override void | DrawLine (int x1, int y1, int x2, int y2)
| Draw line in screen coordinates with currently selected color.
override void | DrawRectangle (int x1, int y1, int width, int height)
| Draws outlined 2d rectangle with x1 and y1 coordinates of top left and width and height, using current color.
override void | DrawFilledRectangle (int x1, int y1, int width, int height)
| Draws filled 2d rectangle with x1 and y1 coordinates of top left and width and height, using current color.
override void | DrawImage (int x, int y)
| Draws currently selected texture in real size to specified place on screen. NOTE - uses current color, don't forget to set it to white unless you want colored image.
override void | DrawImage (int x, int y, int width, int height)
| Draws currently selected texture scaled to specified width and height.
override void | DrawImagePart (int x, int y, int width, int height, int sourcex, int sourcey, int sourcewidth, int sourceheight)
| Draws scaled part of the currently selected texture on the screen.
override void | DrawSprite (int x, int y, ref SpriteInfo sprite)
| Draws sprite with currently selected texture.
override void | DrawSprites (int x, int y, SpriteInfo[] sprites)
| Draws array of sprites with currently selected texture.
override void | Draw2DArray (int x, int y, Vertex2D[] vertices)
override void | SetColor (ref ColorByte col)
| Sets main rendering color (especially for 2d rendering)
override void | SetTransformation (ref Matrix4 mat)
| Sets model transformation (without camera transformation)
void | SetSimpleMaterial ()
override void | DrawSkybox (ref SkyboxData skybox)
| Draws simple skybox.
override void | DrawPoint3D (IVertex point)
| Draws one vertex as a point.
override void | DrawPoint3D (ref Vector3 vec)
| Draws one vector as a point.
override void | DrawLine3D (IVertex first, IVertex second)
| Draws single line from first to second.
override void | DrawLine3D (ref Vector3 first, ref Vector3 second)
| Draws single line from first to second.
override void | DrawQuad3D (ref Vector3 first, ref Vector3 second, ref Vector3 third, ref Vector3 fourth)
| Draws single quad specified by four vertices.
override void | DrawTriangle3D (ref Vector3 first, ref Vector3 second, ref Vector3 third)
| Draws single triangle specified by three vertices.
override void | DrawTriangle3D (IVertex first, IVertex second, IVertex third)
| Draws single triangle specified by three vertices.
override void | DrawQuad3D (IVertex first, IVertex second, IVertex third, IVertex fourth)
| Draws single quad specified by four vertices.
override void | RenderQuads (IVertexArray varray, int startindex=0, int count=0)
| Renders quads from vertex array.
override void | RenderTriangles (IVertexArray varray, int startindex=0, int count=0)
| Renders triangles from vertex array.
override void | RenderPoints (IVertexArray points, int startindex=0, int count=0)
| Renders points from vertex array.
override void | RenderLines (IVertexArray varray, int startindex=0, int count=0)
| Renders lines from vertex array.
override void | RenderLine (IVertexArray varray, int startindex=0, int count=0)
| Renders polyline from vertex array.
override void | RenderPoly (IVertexArray varray, int startindex=0, int count=0)
| Renders polygon from vertex array.
void | GetBeginMode (PrimitiveTypes type, out BeginMode bm, out int vertperelement)
override void | RenderIndexedMesh (IVertexArray varray, int[] indices, PrimitiveTypes type, int startindex=0, int count=0)
| Renders indexed mesh from vertex array.
override void | RenderIndexedMesh (IVertexBuffer vertices, int[] indices, PrimitiveTypes type, int startindex=0, int count=0)
| Renders indexed mesh from vertex and index buffer.
override void | RenderIndexedMesh (IVertexBuffer vertices, IIndexBuffer indices, PrimitiveTypes type, int startindex=0, int count=0)
| Renders indexed mesh from vertex and index buffer.
override void | RenderVertexBuffer (IVertexBuffer vertices, PrimitiveTypes type, int startindex=0, int count=0)
| Render vertex buffer as specified type of primitive (can't be used for indexed meshes!)
| GLRenderContext (RenderPlugin gl, RenderContextSettings set, OpenTK.GLControl glc)
void | StartUp ()
override void | StartFrame ()
| Starts rendering frame.
override void | EndFrame ()
| Finished rendering frame and shows it.
override Bitmap | GetScreenShot ()
| Grabs actual content of the render context and converts it to bitmap.
override void | RenderFrame ()
| Renders frame in standard way (StartFrame and then EndFrame with associated callbacks)
## Public Attributes
RPYTransformation | testobj = null
## Protected Member Functions
void | DrawSprite (ref SpriteInfo sp)
void | DrawImmediateVertex (ref IVertex point, ref VertexDescriptor vd)
void | DrawImmediateVertex (ref Vector3 point)
void | RenderArrayImmediate (IVertexArray varray, int startindex=0, int count=0)
void | RenderArrayImmediate (IVertexArray varray, bool docolors, bool donormals, bool dotexcoor, int startindex=0, int count=0)
void | SetArrayPointers (VertexDescriptor vd, IntPtr basePointer, uint vertexbuffer=0, uint indexbuffer=0)
| Sets pointers for array drawing. Note, fixes varray.pointer, free it after using!
void | ResetArrayPointers ()
void | RenderArray (BeginMode bm, IVertexArray varray, int vertperelement, int startindex=0, int count=0)
## Protected Attributes
bool | _IS2D = false
## Properties
override bool | Fog`[get, set]`
| Enables / disables fog drawing.
override ColorByte | FogColor`[get, set]`
| Color of the fog.
override float | FogDensity`[get, set]`
| Density of the fog.
override bool | ZBufferUsing`[get, set]`
| Use to directly change using of the zbuffer.
System.Windows.Forms.Control | RenderControl`[get]`
override Texture | CurrentTexture`[get, set]`
| Currently selected texture.

## Constructor & Destructor Documentation

VisimRenderGL.GLRenderContext.GLRenderContext | ( | RenderPlugin | gl,
|  | RenderContextSettings | set,
|  | OpenTK.GLControl | glc
| ) |  |

## Member Function Documentation

override void VisimRenderGL.GLRenderContext.Draw2DArray | ( | int | x,
|  | int | y,
|  | Vertex2D[] | vertices
| ) |  |

override void VisimRenderGL.GLRenderContext.DrawFilledRectangle | ( | int | x1,
|  | int | y1,
|  | int | width,
|  | int | height
| ) |  | `[virtual]`

Draws filled 2d rectangle with x1 and y1 coordinates of top left and width and height, using current color.

Parameters:

  x1 | left upper corner
  y1 | left upper corner
  width | width
  height | height

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawImage | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  | `[virtual]`

Draws currently selected texture scaled to specified width and height.

Parameters:

  x | X coordinate of top left corner
  y | Y coordinate of top left corner
  width | Width of the drawn image
  height | Height of the drawn image

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawImage | ( | int | x,
|  | int | y
| ) |  | `[virtual]`

Draws currently selected texture in real size to specified place on screen. NOTE - uses current color, don't forget to set it to white unless you want colored image.

Parameters:

  x | X coordinate of top left corner
  y | Y coordinate of top left corner

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawImagePart | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height,
|  | int | sourcex,
|  | int | sourcey,
|  | int | sourcewidth,
|  | int | sourceheight
| ) |  | `[virtual]`

Draws scaled part of the currently selected texture on the screen.

Parameters:

  x | X coordinate of top left corner
  y | Y coordinate of top left corner
  width | Width of the drawn image
  height | Height of the drawn image
  sourcex | X coordinate of top left corner inside the texture
  sourcey | Y coordinate of top left corner inside the texture
  sourcewidth | Width of the texture part
  sourceheight | Height of the texture part

Implements VisimBox.Renderer.RenderContext.

void VisimRenderGL.GLRenderContext.DrawImmediateVertex | ( | ref IVertex | point,
|  | ref VertexDescriptor | vd
| ) |  | `[protected]`

void VisimRenderGL.GLRenderContext.DrawImmediateVertex | ( | ref Vector3 | point | ) | `[protected]`

override void VisimRenderGL.GLRenderContext.DrawLine | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2
| ) |  | `[virtual]`

Draw line in screen coordinates with currently selected color.

Parameters:

  x1 | x of the start of the line
  y1 | y of the start of the line
  x2 | X of the end of the line
  y2 | y of the end of the line

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawLine3D | ( | IVertex | first,
|  | IVertex | second
| ) |  | `[virtual]`

Draws single line from first to second.

This is slow, use only in special circumstances (debug rendering)

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawLine3D | ( | ref Vector3 | first,
|  | ref Vector3 | second
| ) |  | `[virtual]`

Draws single line from first to second.

This is slow, use only in special circumstances (debug rendering)

Reimplemented from VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawPoint | ( | int | x,
|  | int | y
| ) |  | `[virtual]`

Draw point in screen coordinates with currently selected color.

Parameters:

  x | X position
  y | Y position

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawPoint3D | ( | ref Vector3 | vec | ) | `[virtual]`

Draws one vector as a point.

This is slow, use only in special circumstances (debug rendering)

Reimplemented from VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawPoint3D | ( | IVertex | point | ) | `[virtual]`

Draws one vertex as a point.

This is slow, use only in special circumstances (debug rendering)

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawQuad3D | ( | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third,
|  | ref Vector3 | fourth
| ) |  | `[virtual]`

Draws single quad specified by four vertices.

Reimplemented from VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawQuad3D | ( | IVertex | first,
|  | IVertex | second,
|  | IVertex | third,
|  | IVertex | fourth
| ) |  | `[virtual]`

Draws single quad specified by four vertices.

This is slow, use only in special circumstances (debug rendering)

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawRectangle | ( | int | x1,
|  | int | y1,
|  | int | width,
|  | int | height
| ) |  | `[virtual]`

Draws outlined 2d rectangle with x1 and y1 coordinates of top left and width and height, using current color.

Parameters:

  x1 | left upper corner
  y1 | left upper corner
  width | width
  height | height

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawSkybox | ( | ref SkyboxData | skybox | ) | `[virtual]`

Draws simple skybox.

Parameters:

  skybox | Skybox data (note, textures in skybox must be initialized!)

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawSprite | ( | int | x,
|  | int | y,
|  | ref SpriteInfo | sprite
| ) |  |

Draws sprite with currently selected texture.

Parameters:

  x | X position (screen coords) for the sprite
  y | Y position (screen coords) for the sprite
  sprite | Sprite information

void VisimRenderGL.GLRenderContext.DrawSprite | ( | ref SpriteInfo | sp | ) | `[protected]`

override void VisimRenderGL.GLRenderContext.DrawSprites | ( | int | x,
|  | int | y,
|  | SpriteInfo[] | sprites
| ) |  |

Draws array of sprites with currently selected texture.

Parameters:

  x | X position (screen coords) for the sprite
  y | Y position (screen coords) for the sprite
  sprites | Sprite information

override void VisimRenderGL.GLRenderContext.DrawTriangle3D | ( | ref Vector3 | first,
|  | ref Vector3 | second,
|  | ref Vector3 | third
| ) |  | `[virtual]`

Draws single triangle specified by three vertices.

This is slow, use only in special circumstances (debug rendering)

Reimplemented from VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.DrawTriangle3D | ( | IVertex | first,
|  | IVertex | second,
|  | IVertex | third
| ) |  | `[virtual]`

Draws single triangle specified by three vertices.

This is slow, use only in special circumstances (debug rendering)

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.EndFrame | ( |  | ) | `[virtual]`

Finished rendering frame and shows it.

Reimplemented from VisimBox.Renderer.RenderContext.

void VisimRenderGL.GLRenderContext.GetBeginMode | ( | PrimitiveTypes | type,
|  | out BeginMode | bm,
|  | out int | vertperelement
| ) |  |

!

!

override Bitmap VisimRenderGL.GLRenderContext.GetScreenShot | ( |  | ) | `[virtual]`

Grabs actual content of the render context and converts it to bitmap.

Returns:
  BMP containg current output on the render context

Reimplemented from VisimBox.Renderer.RenderContext.

void VisimRenderGL.GLRenderContext.RenderArray | ( | BeginMode | bm,
|  | IVertexArray | varray,
|  | int | vertperelement,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[protected]`

void VisimRenderGL.GLRenderContext.RenderArrayImmediate | ( | IVertexArray | varray,
|  | bool | docolors,
|  | bool | donormals,
|  | bool | dotexcoor,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[protected]`

void VisimRenderGL.GLRenderContext.RenderArrayImmediate | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[protected]`

override void VisimRenderGL.GLRenderContext.RenderFrame | ( |  | ) | `[virtual]`

Renders frame in standard way (StartFrame and then EndFrame with associated callbacks)

Reimplemented from VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderIndexedMesh | ( | IVertexArray | varray,
|  | int[] | indices,
|  | PrimitiveTypes | type,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders indexed mesh from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  indices | Indices for elements
  type | Type of primitive in indexed mesh (valid are Poins, Lines, Triangles and Quads)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderIndexedMesh | ( | IVertexBuffer | vertices,
|  | int[] | indices,
|  | PrimitiveTypes | type,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders indexed mesh from vertex and index buffer.

Parameters:

  vertices | Vertex buffer
  indices | Index buffer
  type | Primitive type
  startindex | starting index
  count | Number of elements

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderIndexedMesh | ( | IVertexBuffer | vertices,
|  | IIndexBuffer | indices,
|  | PrimitiveTypes | type,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders indexed mesh from vertex and index buffer.

Parameters:

  vertices | Vertex buffer
  indices | Index buffer
  type | Primitive type
  startindex | starting index
  count | Number of elements

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderLine | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders polyline from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderLines | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders lines from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderPoints | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders points from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderPoly | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders polygon from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderQuads | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders quads from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderTriangles | ( | IVertexArray | varray,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Renders triangles from vertex array.

Parameters:

  varray | Vertex array with vertices (should be VertexArray, not VertexList)
  startindex | Starting index of elements
  count | Count of elements (if zero, all remaining elements from starting index will be drawn

Rendering from system memory is (depending on the implementation, applies for openGL) much faster then direct rendering, but still slower then vertex buffers.

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.RenderVertexBuffer | ( | IVertexBuffer | vertices,
|  | PrimitiveTypes | type,
|  | int | startindex = `0`,
|  | int | count = `0`
| ) |  | `[virtual]`

Render vertex buffer as specified type of primitive (can't be used for indexed meshes!)

Parameters:

  vertices | Vertex buffer
  type | Primitive type
  startindex | starting index
  count | Number of elements

Implements VisimBox.Renderer.RenderContext.

void VisimRenderGL.GLRenderContext.ResetArrayPointers | ( |  | ) | `[protected]`

void VisimRenderGL.GLRenderContext.SetArrayPointers | ( | VertexDescriptor | vd,
|  | IntPtr | basePointer,
|  | uint | vertexbuffer = `0`,
|  | uint | indexbuffer = `0`
| ) |  | `[protected]`

Sets pointers for array drawing. Note, fixes varray.pointer, free it after using!

Parameters:

  varray |

override void VisimRenderGL.GLRenderContext.SetColor | ( | ref ColorByte | col | ) | `[virtual]`

Sets main rendering color (especially for 2d rendering)

Parameters:

  col | Color

Implements VisimBox.Renderer.RenderContext.

void VisimRenderGL.GLRenderContext.SetSimpleMaterial | ( |  | ) |

override void VisimRenderGL.GLRenderContext.SetTransformation | ( | ref Matrix4 | mat | ) | `[virtual]`

Sets model transformation (without camera transformation)

Parameters:

  mat |

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.Start2DRender | ( |  | ) | `[virtual]`

Sets renderer to 2d context, all 2d rendering calls should be done after this call!

Implements VisimBox.Renderer.RenderContext.

override void VisimRenderGL.GLRenderContext.StartFrame | ( |  | ) | `[virtual]`

Starts rendering frame.

Reimplemented from VisimBox.Renderer.RenderContext.

void VisimRenderGL.GLRenderContext.StartUp | ( |  | ) |

override void VisimRenderGL.GLRenderContext.Stop2DRender | ( |  | ) | `[virtual]`

Returns renderer to previous (3d) rendering state from the 2d renderer.

Implements VisimBox.Renderer.RenderContext.

## Member Data Documentation

bool VisimRenderGL.GLRenderContext._IS2D = false`[protected]`

RPYTransformation VisimRenderGL.GLRenderContext.testobj = null

## Property Documentation

override Texture VisimRenderGL.GLRenderContext.CurrentTexture`[get, set]`

Currently selected texture.

Reimplemented from VisimBox.Renderer.RenderContext.

override bool VisimRenderGL.GLRenderContext.Fog`[get, set]`

Enables / disables fog drawing.

Reimplemented from VisimBox.Renderer.RenderContext.

override ColorByte VisimRenderGL.GLRenderContext.FogColor`[get, set]`

Color of the fog.

Reimplemented from VisimBox.Renderer.RenderContext.

override float VisimRenderGL.GLRenderContext.FogDensity`[get, set]`

Density of the fog.

Reimplemented from VisimBox.Renderer.RenderContext.

System.Windows.Forms.Control VisimRenderGL.GLRenderContext.RenderControl`[get]`

override bool VisimRenderGL.GLRenderContext.ZBufferUsing`[get, set]`

Use to directly change using of the zbuffer.

Reimplemented from VisimBox.Renderer.RenderContext.

The documentation for this class was generated from the following files:

- GLRCRender2D.cs
- GLRenderContext.cs
- GLRCRendering.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events