31 glEnable(GL_CULL_FACE);
37 glDisable(GL_CULL_FACE);
45 glEnable(GL_DEPTH_TEST);
50 glDisable(GL_DEPTH_TEST);
59 glDepthRangef(0.0
f, 1.0
f);
63 glDepthMask(GL_FALSE);
72 glBlendFunc(src, dest);
73 glBlendEquation(func);
89 current.
set_attribfv(name, num_components, stride, offset);
106 bool read_file(
const std::string &path, std::string &dest)
110 std::string msg =
"Failed to open file " + path;
111 ASSERT(in.is_open() && in.good(), msg.c_str());
114 dest.resize(in.tellg());
115 in.seekg(0, std::ios::beg);
116 in.read(&dest[0], dest.size());
125 glGenBuffers(1, &buffer);
126 glBindBuffer(target, buffer);
127 glBufferData(target, size, data, usage);
128 glBindBuffer(target, 0);
134 return gen_buffer(target, GL_STATIC_DRAW, size, data);
139 glDeleteBuffers(1, &buffer);
void set_attribfv(string name, GLsizei num_components, GLsizei stride, GLsizei offset)
GLenum GLuint GLintptr offset
void del_buffer(GLuint buffer)
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLenum void * binary
bool read_file(const std::string &path, std::string &dest)
void set_uniform(string name, const mat4 &v)
void cull(bool enabled, GLenum front, GLenum mode)
GLuint gen_buffer(GLenum target, GLenum usage, GLsizei size, const void *data)
GLenum GLuint GLintptr GLsizeiptr size
void uniform(string name, const mat4 &v)
void attribfv(string name, GLsizei num_components, GLsizei stride, GLsizei offset)
const void GLsizei GLsizei stride
void use_shader(Shader shader)
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
void depth_write(bool enabled)
typedef GLuint(GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC)(GLuint count
void unset_attrib(string name)
void unset_attrib(string name)
void depth_test(bool enabled, GLenum func)
void blend_mode(bool enabled, GLenum src, GLenum dest, GLenum func)