Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Vesper::OpenGLRendererAPI Class Reference

An implementation of the RendererAPI for OpenGL. More...

#include <OpenGLRendererAPI.h>

Inheritance diagram for Vesper::OpenGLRendererAPI:
Vesper::RendererAPI

Public Member Functions

virtual void Init () override
 Initializes the OpenGL rendering API.
virtual void SetViewport (uint32_t x, uint32_t y, uint32_t width, uint32_t height) override
 Sets the viewport dimensions for OpenGL.
virtual void SetClearColor (const glm::vec4 &color) override
 Sets the clear color for OpenGL.
virtual void Clear () override
 Clears the OpenGL rendering buffers.
virtual void DrawIndexed (const Ref< VertexArray > &vertexArray, uint32_t indexCount=0) override
 Draws indexed geometry using the provided vertex array in OpenGL.
Public Member Functions inherited from Vesper::RendererAPI
virtual ~RendererAPI ()=default

Additional Inherited Members

Public Types inherited from Vesper::RendererAPI
enum class  API { None = 0 , OpenGL = 1 }
 API. More...
Static Public Member Functions inherited from Vesper::RendererAPI
static API GetAPI ()
 Returns the current rendering API.

Detailed Description

An implementation of the RendererAPI for OpenGL.

Note
Should only be called by the RenderCommand class.

Member Function Documentation

◆ Clear()

void Vesper::OpenGLRendererAPI::Clear ( )
overridevirtual

Clears the OpenGL rendering buffers.

Implements Vesper::RendererAPI.

30 {
32
33 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
34 }
#define VZ_PROFILE_FUNCTION()
Definition Instrumentor.h:240

◆ DrawIndexed()

void Vesper::OpenGLRendererAPI::DrawIndexed ( const Ref< VertexArray > & vertexArray,
uint32_t indexCount = 0 )
overridevirtual

Draws indexed geometry using the provided vertex array in OpenGL.

Implements Vesper::RendererAPI.

37 {
39
40 uint32_t count = indexCount ? indexCount : vertexArray->GetIndexBuffer()->GetCount();
41 glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr);
42 glBindTexture(GL_TEXTURE_2D, 0);
43 }

◆ Init()

void Vesper::OpenGLRendererAPI::Init ( )
overridevirtual

Initializes the OpenGL rendering API.

Implements Vesper::RendererAPI.

9 {
10 glEnable(GL_BLEND);
11 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
12 glEnable(GL_DEPTH_TEST);
13 }

◆ SetClearColor()

void Vesper::OpenGLRendererAPI::SetClearColor ( const glm::vec4 & color)
overridevirtual

Sets the clear color for OpenGL.

Implements Vesper::RendererAPI.

23 {
25
26 glClearColor(color.r, color.g, color.b, color.a);
27 }

◆ SetViewport()

void Vesper::OpenGLRendererAPI::SetViewport ( uint32_t x,
uint32_t y,
uint32_t width,
uint32_t height )
overridevirtual

Sets the viewport dimensions for OpenGL.

Implements Vesper::RendererAPI.

16 {
18
19 glViewport(x, y, width, height);
20 }

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