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::OpenGLContext Class Reference

#include <OpenGLContext.h>

Inheritance diagram for Vesper::OpenGLContext:
Vesper::GraphicsContext

Public Member Functions

 OpenGLContext (GLFWwindow *windowHandle)
virtual ~OpenGLContext ()
void Init () override
 Initializes the graphics context.
void SwapBuffers () override
 Swaps the front and back buffers.
Public Member Functions inherited from Vesper::GraphicsContext
virtual ~GraphicsContext ()

Private Attributes

GLFWwindow * m_WindowHandle

Constructor & Destructor Documentation

◆ OpenGLContext()

Vesper::OpenGLContext::OpenGLContext ( GLFWwindow * windowHandle)
12 : m_WindowHandle(windowHandle)
13 {
14 VZ_CORE_ASSERT(windowHandle, "Window handle is null!");
15
16 }
#define VZ_CORE_ASSERT(x,...)
Definition Asserts.h:20
GLFWwindow * m_WindowHandle
Definition OpenGLContext.h:16

References m_WindowHandle.

◆ ~OpenGLContext()

Vesper::OpenGLContext::~OpenGLContext ( )
virtual
19 {
20 }

Member Function Documentation

◆ Init()

void Vesper::OpenGLContext::Init ( )
overridevirtual

Initializes the graphics context.

Implements Vesper::GraphicsContext.

23 {
25
26 glfwMakeContextCurrent(m_WindowHandle);
27 int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
28 VZ_CORE_ASSERT(status, "Failed to initialize Glad!");
29
30 VZ_CORE_INFO("OpenGL Info:");
31 VZ_CORE_INFO(" Vendor: {0}", (const char *)glGetString(GL_VENDOR));
32 VZ_CORE_INFO(" Renderer: {0}", (const char *)glGetString(GL_RENDERER));
33 VZ_CORE_INFO(" Version: {0}", (const char *)glGetString(GL_VERSION));
34
35#ifdef VZ_ENABLE_ASSERTS
36 int major = 0, minor = 0;
37 glGetIntegerv(GL_MAJOR_VERSION, &major);
38 glGetIntegerv(GL_MINOR_VERSION, &minor);
39 VZ_CORE_ASSERT(major > 4 || (major == 4 && minor >= 5), "Vesper requires at least OpenGL version 4.5!");
40#endif
41
42 }
#define VZ_PROFILE_FUNCTION()
Definition Instrumentor.h:240
#define VZ_CORE_INFO(...)
info: general information about application flow
Definition Log.h:37

References m_WindowHandle.

◆ SwapBuffers()

void Vesper::OpenGLContext::SwapBuffers ( )
overridevirtual

Swaps the front and back buffers.

Implements Vesper::GraphicsContext.

45 {
47 glfwSwapBuffers(m_WindowHandle);
48
49 }

References m_WindowHandle.

Member Data Documentation

◆ m_WindowHandle

GLFWwindow* Vesper::OpenGLContext::m_WindowHandle
private

Referenced by Init(), OpenGLContext(), and SwapBuffers().


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