Class ClassicGL
Implements
Inherited Members
Namespace: Genesis.Graphics.RenderDevice
Assembly: Genesis.dll
Syntax
public class ClassicGL : IRenderDevice
Constructors
ClassicGL(IntPtr)
Declaration
public ClassicGL(IntPtr hwnd)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | hwnd |
Methods
Begin()
Begins the rendering process.
Declaration
public void Begin()
BuildFramebuffer(int, int)
Builds a framebuffer with the specified width and height.
Declaration
public Framebuffer BuildFramebuffer(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the framebuffer. |
int | height | The height of the framebuffer. |
Returns
Type | Description |
---|---|
Framebuffer | The built 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. |
CreateDynamicVertexBuffer(float[])
Creates a dynamic vertex buffer with the specified float array.
Declaration
public int CreateDynamicVertexBuffer(float[] floats)
Parameters
Type | Name | Description |
---|---|---|
float[] | floats | The float array for the dynamic vertex buffer. |
Returns
Type | Description |
---|---|
int | The ID of the created dynamic vertex buffer. |
CreateStaticVertexBuffer(float[])
Creates a static vertex buffer with the specified vertices.
Declaration
public int CreateStaticVertexBuffer(float[] verticies)
Parameters
Type | Name | Description |
---|---|---|
float[] | verticies | The vertices for the static vertex buffer. |
Returns
Type | Description |
---|---|
int | The ID of the created static vertex buffer. |
Dispose()
Disposes of the rendering device and releases any resources.
Declaration
public void Dispose()
DisposeElement(GameElement)
Disposes the game element
Declaration
public void DisposeElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The element to dispose |
DisposeElement3D(Element3D)
Disposes the specified 3D element, freeing up resources.
Declaration
public void DisposeElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element | The 3D element to dispose. |
DisposeFont(Font)
Disposes the specified font, freeing up resources.
Declaration
public void DisposeFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font to dispose. |
DisposeTexture(Texture)
Disposes the specified texture, freeing up resources.
Declaration
public void DisposeTexture(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to dispose. |
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 a 3D element in the current rendering context.
Declaration
public void DrawElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element | The 3D element to draw. |
DrawGameElement(GameElement)
Draws a game element in the current rendering context.
Declaration
public void DrawGameElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The game element to draw. |
DrawLine(Vec3, Vec3, Color)
Draws a line with specified starting and ending points and color in the current rendering context.
Declaration
public void DrawLine(Vec3 from, Vec3 to, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | from | The starting point of the line. |
Vec3 | to | The ending point of the line. |
Color | color | The color of the line. |
DrawMesh(Mesh, Color)
Draws a mesh with specified mesh and color in the current rendering context.
Declaration
public void DrawMesh(Mesh mesh, Color color)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to draw. |
Color | color | The color of the mesh. |
DrawRect(Rect, Color)
Draws a colored rectangle with specified position and size in the current rendering context.
Declaration
public void DrawRect(Rect rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The rectangle to draw. |
Color | color | The color of the rectangle. |
DrawRect(Rect, Color, float)
Draws a colored rectangle with specified position, size, and border width in the current rendering context.
Declaration
public void DrawRect(Rect rect, Color color, float borderWidth)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The rectangle to draw. |
Color | color | The color of the rectangle. |
float | borderWidth | The width of the rectangle border. |
DrawSkyBox(Skybox)
Draws a skybox in the current rendering context.
Declaration
public void DrawSkyBox(Skybox skybox)
Parameters
Type | Name | Description |
---|---|---|
Skybox | skybox | The skybox to draw. |
DrawSprite(Sprite)
Draws a sprite in the current rendering context.
Declaration
public void DrawSprite(Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite | The sprite to draw. |
DrawSprite(Vec3, Vec3, Texture)
Draws a sprite with specified location, size, and texture in the current rendering context.
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Texture | texture | The texture of the sprite. |
DrawSprite(Vec3, Vec3, Texture, TexCoords)
Draws a sprite with specified location, size, texture, and texture coordinates in the current rendering context.
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Texture texture, TexCoords texCoords)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Texture | texture | The texture of the sprite. |
TexCoords | texCoords | The texture coordinates of the sprite. |
DrawSprite(Vec3, Vec3, Color, Texture)
Draws a sprite with specified location, size, color, and texture in the current rendering context.
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Color | color | The color of the sprite. |
Texture | texture | The texture of the sprite. |
DrawSprite(Vec3, Vec3, Color, Texture, TexCoords)
Draws a sprite with specified location, size, color, texture, and texture coordinates in the current rendering context.
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture, TexCoords texCoords)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Color | color | The color of the sprite. |
Texture | texture | The texture of the sprite. |
TexCoords | texCoords | The texture coordinates of the sprite. |
DrawString(string, Vec3, float, Font, Color)
Draws a string with specified text, location, fontsize, font, and color in the current rendering context.
Declaration
public void DrawString(string text, Vec3 location, float fontSize, Font font, Color color)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to draw. |
Vec3 | location | The location of the text. |
float | fontSize | |
Font | font | The font to use for drawing the text. |
Color | color | The color of the text. |
DrawString(string, Vec3, float, float, Font, Color)
Draws a string with specified text, location, fontsize, spacing, font, and color in the current rendering context.
Declaration
public void DrawString(string text, Vec3 location, float fontSize, float spacing, Font font, Color color)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to draw. |
Vec3 | location | The location of the text. |
float | fontSize | |
float | spacing | The spacing between characters. |
Font | font | The font to use for drawing the text. |
Color | color | The color of the text. |
DrawTexture(Vec3, Vec3, float, float, Texture)
Draws a texture with specified location, size, and texture coordinates in the current rendering context.
Declaration
public void DrawTexture(Vec3 location, Vec3 size, float repeateX, float repeatY, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the texture. |
Vec3 | size | The size of the texture. |
float | repeateX | |
float | repeatY | The vertical texture repeat factor. |
Texture | texture | The texture to draw. |
DrawVectors(Vec3[], Color)
Draws vectors with specified positions in the current rendering context.
Declaration
public void DrawVectors(Vec3[] vecs, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3[] | vecs | The array of vectors to draw. |
Color | color | The color of the vectors. |
End()
Ends the rendering process.
Declaration
public void End()
FillRect(Rect, Color)
Fills a colored rectangle with specified position and size in the current rendering context.
Declaration
public void FillRect(Rect rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The rectangle to fill. |
Color | color | The color to fill the rectangle with. |
FinishCanvasRendering(Scene, Canvas)
Finishes the rendering for a canvas within a 2D scene.
Declaration
public void FinishCanvasRendering(Scene scene, Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene containing the canvas. |
Canvas | canvas | The canvas to finish rendering. |
FinishSceneRendering(Scene)
Finishes the rendering for a 2D scene.
Declaration
public void FinishSceneRendering(Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene to finish rendering. |
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()
Gets the last OpenGL error code.
Declaration
public int GetError()
Returns
Type | Description |
---|---|
int | The error code. |
GetHandle()
Gets the handle (pointer) to the underlying rendering context.
Declaration
public IntPtr GetHandle()
Returns
Type | Description |
---|---|
IntPtr | The handle to the rendering context. |
Init()
Initializes the rendering device.
Declaration
public void Init()
InitElement3D(Element3D)
Initializes a 3D element for rendering.
Declaration
public void InitElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element |
InitGameElement(GameElement)
Initializes a game element for rendering.
Declaration
public void InitGameElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element |
InitSprite(Sprite)
Initializes a sprite for rendering.
Declaration
public void InitSprite(Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite |
LoadFont(Font)
Loads a font into the rendering device.
Declaration
public void LoadFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font to load. |
LoadTexture(Texture)
Loads a texture into the rendering device.
Declaration
public void LoadTexture(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to load. |
ModelViewMatrix()
Sets the current rendering matrix to the model-view matrix.
Declaration
public void ModelViewMatrix()
PopMatrix()
Pops the matrix from the top of the matrix stack.
Declaration
public void PopMatrix()
PrepareCanvasRendering(Scene, Canvas)
Prepares the rendering for a canvas within a 2D scene.
Declaration
public void PrepareCanvasRendering(Scene scene, Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene containing the canvas. |
Canvas | canvas | The canvas to prepare rendering for. |
PrepareSceneRendering(Scene)
Prepares the rendering for a 2D scene.
Declaration
public void PrepareSceneRendering(Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene to prepare. |
ProjectionMatrix()
Sets the current rendering matrix to the projection matrix.
Declaration
public void ProjectionMatrix()
PushMatrix()
Pushes the current matrix onto the matrix stack.
Declaration
public void PushMatrix()
Rotate(float, Vec3)
Rotates the matrix by the specified angle around the given vector.
Declaration
public void Rotate(float angle, Vec3 vector)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The rotation angle in degrees. |
Vec3 | vector | The vector to rotate around. |
SetCamera(Camera)
Sets the camera for rendering.
Declaration
public void SetCamera(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to set. |
SetFramebuffer(Framebuffer)
Sets the active framebuffer using its ID.
Declaration
public void SetFramebuffer(Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | framebuffer | The ID of the framebuffer to set as active. |
SetFramebuffer(int)
Sets the active framebuffer using the specified framebuffer object.
Declaration
public void SetFramebuffer(int framebuffer)
Parameters
Type | Name | Description |
---|---|---|
int | framebuffer | The framebuffer to set as active. |
SetLightSource(Light)
Sets the light source for rendering.
Declaration
public void SetLightSource(Light light)
Parameters
Type | Name | Description |
---|---|---|
Light | light | The light source to set. |
TextureClampS()
Sets the texture wrapping mode to clamp in the S direction.
Declaration
public void TextureClampS()
TextureClampT()
Sets the texture wrapping mode to clamp in the T direction.
Declaration
public void TextureClampT()
TextureRepeatS()
Sets the texture wrapping mode to repeat in the S direction.
Declaration
public void TextureRepeatS()
TextureRepeatT()
Sets the texture wrapping mode to repeat in the T direction.
Declaration
public void TextureRepeatT()
Translate(Vec3)
Translates the matrix by the specified vector.
Declaration
public void Translate(Vec3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | vector | The translation vector. |
Translate(float, float, float)
Translates the matrix by the specified coordinates.
Declaration
public void Translate(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
float | x | The x-coordinate translation. |
float | y | The y-coordinate translation. |
float | z | The z-coordinate translation. |
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 rendering.
Declaration
public void Viewport(float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
float | x | The x-coordinate of the viewport. |
float | y | The y-coordinate of the viewport. |
float | width | The width of the viewport. |
float | height | The height of the viewport. |