Class GLRenderer
Implements
Inherited Members
Namespace: Genesis.Graphics.RenderDevice
Assembly: Genesis.dll
Syntax
public class GLRenderer : IRenderDevice
Constructors
GLRenderer(IntPtr)
Declaration
public GLRenderer(IntPtr hwnd)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hwnd |
Fields
sceneBuffer
Declaration
public Framebuffer sceneBuffer
Field Value
| Type | Description |
|---|---|
| Framebuffer |
Methods
Begin()
Beginn to draw
Declaration
public void Begin()
BuildFramebuffer(int, int)
Creates a new framebuffer
Declaration
public Framebuffer BuildFramebuffer(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | |
| int | height |
Returns
| Type | Description |
|---|---|
| Framebuffer |
BuildFramebuffer(int, int, Texture)
Builds a framebuffer with the specified width, height, and texture.
Declaration
public Framebuffer BuildFramebuffer(int width, int height, Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The width of the framebuffer. |
| int | height | The height of the framebuffer. |
| Texture | texture | The texture associated with the framebuffer. |
Returns
| Type | Description |
|---|---|
| Framebuffer | The built framebuffer. |
BuildFramebuffer(int, int, int)
Builds a framebuffer with the specified width, height, and texture ID.
Declaration
public Framebuffer BuildFramebuffer(int width, int height, int texture)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | The width of the framebuffer. |
| int | height | The height of the framebuffer. |
| int | texture | The ID of the texture associated with the framebuffer. |
Returns
| Type | Description |
|---|---|
| Framebuffer | The built framebuffer. |
BuildShape(Shape)
Creates an buffer for the shape
Declaration
public void BuildShape(Shape shape)
Parameters
| Type | Name | Description |
|---|---|---|
| Shape | shape |
CreateDynamicVertexBuffer(float[])
Creates a dynamic vertex buffer in OpenGL and initializes it with the specified vertices. Dynamic buffers are suitable for frequently changing data, like dynamic vertex updates.
Declaration
public int CreateDynamicVertexBuffer(float[] verticies)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | verticies | The array of vertices to be stored in the buffer. |
Returns
| Type | Description |
|---|---|
| int | The OpenGL handle (ID) of the created dynamic vertex buffer. |
CreateStaticVertexBuffer(float[])
Creates a static vertex buffer in OpenGL and initializes it with the specified vertices. Static buffers are suitable for infrequently changing data, like static geometry.
Declaration
public int CreateStaticVertexBuffer(float[] verticies)
Parameters
| Type | Name | Description |
|---|---|---|
| float[] | verticies | The array of vertices to be stored in the buffer. |
Returns
| Type | Description |
|---|---|
| int | The OpenGL handle (ID) of the created static vertex buffer. |
Dispose()
Disposes the render device
Declaration
public void Dispose()
DisposeElement(GameElement)
Disposes the element data from the gpu
Declaration
public void DisposeElement(GameElement element)
Parameters
| Type | Name | Description |
|---|---|---|
| GameElement | element | The element to dispose |
DisposeElement3D(Element3D)
Dispose the 3D element
Declaration
public void DisposeElement3D(Element3D element)
Parameters
| Type | Name | Description |
|---|---|---|
| Element3D | element |
DisposeFont(Font)
Disposes the font
Declaration
public void DisposeFont(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font |
DisposeShader(ShaderProgram)
Deletes the shader program
Declaration
public void DisposeShader(ShaderProgram program)
Parameters
| Type | Name | Description |
|---|---|---|
| ShaderProgram | program |
DisposeTexture(Texture)
Disposes the texture
Declaration
public void DisposeTexture(Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture |
DrawBufferedSprite(BufferedSprite)
Draws a buffered sprite in the current rendering context.
Declaration
public void DrawBufferedSprite(BufferedSprite bufferedSprite)
Parameters
| Type | Name | Description |
|---|---|---|
| BufferedSprite | bufferedSprite | The buffered sprite to draw. |
DrawElement3D(Element3D)
Draws an 3D element within the scene
Declaration
public void DrawElement3D(Element3D element)
Parameters
| Type | Name | Description |
|---|---|---|
| Element3D | element |
DrawGameElement(GameElement)
Renders the GameElement
Declaration
public void DrawGameElement(GameElement element)
Parameters
| Type | Name | Description |
|---|---|---|
| GameElement | element |
DrawLine(Vec3, Vec3, Color)
Draws a line
Declaration
public void DrawLine(Vec3 from, Vec3 to, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | from | |
| Vec3 | to | |
| Color | color |
DrawMesh(Mesh, Color)
Draws a mesh
Declaration
public void DrawMesh(Mesh mesh, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | mesh | |
| Color | color |
DrawParticleEmitter(ParticleEmitter)
Draws the particle emitter
Declaration
public void DrawParticleEmitter(ParticleEmitter emitter)
Parameters
| Type | Name | Description |
|---|---|---|
| ParticleEmitter | emitter |
DrawRect(Rect, Color)
Draws a rect with no fill
Declaration
public void DrawRect(Rect rect, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | rect | |
| Color | color |
DrawRect(Rect, Color, float)
Draws a rect with no fill
Declaration
public void DrawRect(Rect rect, Color color, float borderWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | rect | |
| Color | color | |
| float | borderWidth |
DrawSkyBox(Skybox)
Draws an skybox
Declaration
public void DrawSkyBox(Skybox skybox)
Parameters
| Type | Name | Description |
|---|---|---|
| Skybox | skybox |
DrawSprite(Sprite)
Renders a sprite with modern gl
Declaration
public void DrawSprite(Sprite sprite)
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | sprite |
DrawSprite(Vec3, Vec3, Texture)
Draws a sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | location | |
| Vec3 | size | |
| Texture | texture |
DrawSprite(Vec3, Vec3, Texture, TexCoords)
Draws a sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Texture texture, TexCoords texCoords)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | location | |
| Vec3 | size | |
| Texture | texture | |
| TexCoords | texCoords |
DrawSprite(Vec3, Vec3, Color, Texture)
Renders a sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | location | |
| Vec3 | size | |
| Color | color | |
| Texture | texture |
DrawSprite(Vec3, Vec3, Color, Texture, TexCoords)
Draws a Sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture, TexCoords texCoords)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | location | |
| Vec3 | size | |
| Color | color | |
| Texture | texture | |
| TexCoords | texCoords |
DrawString(string, Vec3, float, Font, Color)
Renders a String
Declaration
public void DrawString(string text, Vec3 location, float fontSize, Font font, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| Vec3 | location | |
| float | fontSize | |
| Font | font | |
| Color | color |
DrawString(string, Vec3, float, float, Font, Color)
Renders a string
Declaration
public void DrawString(string text, Vec3 location, float fontSize, float spacing, Font font, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| Vec3 | location | |
| float | fontSize | |
| float | spacing | |
| Font | font | |
| Color | color |
DrawTexture(Vec3, Vec3, float, float, Texture)
Draws a texture
Declaration
public void DrawTexture(Vec3 location, Vec3 size, float repeateX, float repeatY, Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | location | |
| Vec3 | size | |
| float | repeateX | |
| float | repeatY | |
| Texture | texture |
DrawVectors(Vec3[], Color)
Draws the vector array
Declaration
public void DrawVectors(Vec3[] vecs, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3[] | vecs | |
| Color | color |
End()
Ends the rendering
Declaration
public void End()
FillRect(Rect, Color)
Fills a rectangle with the given color. LegacyGL
Declaration
public void FillRect(Rect rect, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | rect | |
| Color | color |
FinishCanvasRendering(Scene, Canvas)
Finish the canvas rendering
Declaration
public void FinishCanvasRendering(Scene scene, Canvas canvas)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The scene from the canvas |
| Canvas | canvas | The canvas to render |
FinishSceneRendering(Scene)
Finish the scene rendering
Declaration
public void FinishSceneRendering(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The scene which getted rendered |
GenerateTexture(OpenGL, Texture)
Generates a texture
Declaration
public int GenerateTexture(OpenGL gl, Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGL | gl | |
| Texture | texture |
Returns
| Type | Description |
|---|---|
| int |
GenerateTexture(OpenGL, Bitmap)
Generates a texture
Declaration
public int GenerateTexture(OpenGL gl, Bitmap texture)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGL | gl | |
| Bitmap | texture |
Returns
| Type | Description |
|---|---|
| int |
GetError()
Returns an error code from the render device
Declaration
public int GetError()
Returns
| Type | Description |
|---|---|
| int |
GetHandle()
Returns the handle of the render target
Declaration
public IntPtr GetHandle()
Returns
| Type | Description |
|---|---|
| IntPtr |
GetRenderer()
Returns the native renderer
Declaration
public OpenGL GetRenderer()
Returns
| Type | Description |
|---|---|
| OpenGL |
GetShaderProgram(ShaderProgram)
Returns the shader programm with the typeof the refProgram. Returns null is no program found
Declaration
public ShaderProgram GetShaderProgram(ShaderProgram refProgram)
Parameters
| Type | Name | Description |
|---|---|---|
| ShaderProgram | refProgram |
Returns
| Type | Description |
|---|---|
| ShaderProgram |
Init()
Initial the moderngl render device
Declaration
public void Init()
InitElement3D(Element3D)
Inital an 3D element
Declaration
public void InitElement3D(Element3D element)
Parameters
| Type | Name | Description |
|---|---|---|
| Element3D | element |
InitElement3DNormalMap(string)
Inital the normal map for an 3D element if the normal map file isnt existing an empty 1x1 normal map get created
Declaration
public int InitElement3DNormalMap(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path |
Returns
| Type | Description |
|---|---|
| int |
InitElement3DTexture(string)
Initial the diffuse texture for the 3D model If the texture file isnt existing an empty 1x1 texture get created
Declaration
public int InitElement3DTexture(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path |
Returns
| Type | Description |
|---|---|
| int |
InitGameElement(GameElement)
Inits the game element
Declaration
public void InitGameElement(GameElement element)
Parameters
| Type | Name | Description |
|---|---|---|
| GameElement | element |
InitSprite(Sprite)
Initial the sprite
Declaration
public void InitSprite(Sprite sprite)
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | sprite |
LoadFont(Font)
Loads the the font
Declaration
public void LoadFont(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font |
LoadShader(string, ShaderProgram)
Loads a shader program
Declaration
public void LoadShader(string name, ShaderProgram program)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| ShaderProgram | program |
LoadTexture(Texture)
Loads a texture into the vram
Declaration
public void LoadTexture(Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture |
ModelViewMatrix()
This function will not be used within this render device
Declaration
public void ModelViewMatrix()
PopMatrix()
This function will not be used within this render device
Declaration
public void PopMatrix()
PrepareCanvasRendering(Scene, Canvas)
Prepares the renderer for the canvas rendering
Declaration
public void PrepareCanvasRendering(Scene scene, Canvas canvas)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The scene from the canvas |
| Canvas | canvas | The canvas to render |
PrepareSceneRendering(Scene)
Prepares the renderer for scene rendering
Declaration
public void PrepareSceneRendering(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The scene to render |
ProjectionMatrix()
This function will not be used within this render device
Declaration
public void ProjectionMatrix()
PushMatrix()
This function will not be used within this render device
Declaration
public void PushMatrix()
Rotate(float, Vec3)
This function will not be used within this render device
Declaration
public void Rotate(float angle, Vec3 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| float | angle | |
| Vec3 | vector |
SetCamera(Camera)
Set the Projection and view matrices
Declaration
public void SetCamera(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera |
SetFramebuffer(Framebuffer)
Sets an framebuffer as active render target
Declaration
public void SetFramebuffer(Framebuffer framebuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| Framebuffer | framebuffer | The framebuffer for the rendering |
SetFramebuffer(int)
Sets an framebuffer as active render target
Declaration
public void SetFramebuffer(int framebuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| int | framebuffer | The framebuffer id for the rendering |
SetLightSource(Light)
Sets an Lightsource
Declaration
public void SetLightSource(Light light)
Parameters
| Type | Name | Description |
|---|---|---|
| Light | light |
TextureClampS()
Sets the texture clampS
Declaration
public void TextureClampS()
TextureClampT()
Sets the texture clampT
Declaration
public void TextureClampT()
TextureRepeatS()
Sets the texture repeatS
Declaration
public void TextureRepeatS()
TextureRepeatT()
Sets the texture repeatT
Declaration
public void TextureRepeatT()
Translate(Vec3)
This function will not be used within this render device
Declaration
public void Translate(Vec3 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vec3 | vector |
Translate(float, float, float)
This function will not be used within this render device
Declaration
public void Translate(float x, float y, float z)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | |
| float | y | |
| float | z |
UpdateFramebufferSize(Framebuffer, int, int)
Updates the size of the specified framebuffer.
Declaration
public void UpdateFramebufferSize(Framebuffer framebuffer, int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| Framebuffer | framebuffer | The framebuffer to update. |
| int | width | The new width of the framebuffer. |
| int | height | The new height of the framebuffer. |
Viewport(float, float, float, float)
Sets the viewport for the rendering
Declaration
public void Viewport(float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | |
| float | y | |
| float | width | |
| float | height |