mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 20:49:12 +12:00
Boops
This commit is contained in:
parent
78ac8d2c0d
commit
ab4c9b2ae5
7 changed files with 100 additions and 65 deletions
19
third_party/opengl/opengl.hpp
vendored
19
third_party/opengl/opengl.hpp
vendored
|
@ -29,6 +29,7 @@
|
|||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include "helpers.hpp"
|
||||
|
||||
#include <glad/gl.h>
|
||||
|
||||
|
@ -432,6 +433,24 @@ namespace OpenGL {
|
|||
return m_handle != 0;
|
||||
}
|
||||
|
||||
bool createFromBinary(const std::vector<u8>& binary, GLenum format) {
|
||||
m_handle = glCreateProgram();
|
||||
glProgramBinary(m_handle, format, binary.data(), binary.size());
|
||||
GLint success;
|
||||
glGetProgramiv(m_handle, GL_LINK_STATUS, &success);
|
||||
|
||||
if (!success) {
|
||||
char buf[4096];
|
||||
glGetProgramInfoLog(m_handle, 4096, nullptr, buf);
|
||||
fprintf(stderr, "Failed to link program\nError: %s\n", buf);
|
||||
glDeleteProgram(m_handle);
|
||||
|
||||
m_handle = 0;
|
||||
}
|
||||
|
||||
return m_handle != 0;
|
||||
}
|
||||
|
||||
GLuint handle() const { return m_handle; }
|
||||
bool exists() const { return m_handle != 0; }
|
||||
void use() const { glUseProgram(m_handle); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue