RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
Loading...
Searching...
No Matches
Renderer.cpp
Go to the documentation of this file.
1#include "Renderer.h"
2#include <iostream>
3
5{
6 while (glGetError() != GL_NO_ERROR)
7 ;
8}
9
10bool GLLogCall(const char* function, const char* file, int line)
11{
12 while (GLenum error = glGetError())
13 {
14 std::cout << "[OpenGl Error] (" << error << "): " << function << " " << file << ":" << line << std::endl;
15 return false;
16 }
17 return true;
18}
19
20void Renderer::Draw(const VertexArray& va, const IndexBuffer& ib, const Shader& shader) const
21{
22 shader.Bind();
23 va.Bind();
24 ib.Bind();
25 int count = ib.GetCount();
26 GLCall(glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, nullptr));
27}
bool GLLogCall(const char *function, const char *file, int line)
Definition Renderer.cpp:10
void GLClearError()
Definition Renderer.cpp:4
#define GLCall(x)
Definition Renderer.h:12
void Draw(const VertexArray &va, const IndexBuffer &ib, const Shader &shader) const
Definition Renderer.cpp:20