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
4
void
GLClearError
()
5
{
6
while
(glGetError() != GL_NO_ERROR)
7
;
8
}
9
10
bool
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
20
void
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
}
GLLogCall
bool GLLogCall(const char *function, const char *file, int line)
Definition
Renderer.cpp:10
GLClearError
void GLClearError()
Definition
Renderer.cpp:4
Renderer.h
GLCall
#define GLCall(x)
Definition
Renderer.h:12
IndexBuffer
Definition
IndexBuffer.h:3
Renderer::Draw
void Draw(const VertexArray &va, const IndexBuffer &ib, const Shader &shader) const
Definition
Renderer.cpp:20
Shader
Definition
Shader.h:16
VertexArray
Definition
VertexArray.h:7
src
renderer
Renderer.cpp
Generated by
1.10.0