Compare commits
2 Commits
521483f4e0
...
75bda91302
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75bda91302 | ||
|
|
2c4392a51e |
@ -72,10 +72,10 @@ class Buffer : public OpenGLObject {
|
|||||||
if (_id) {
|
if (_id) {
|
||||||
glBindBuffer(Target, _id);
|
glBindBuffer(Target, _id);
|
||||||
} else {
|
} else {
|
||||||
THROW(BufferError(
|
WARN(BufferError(
|
||||||
Codes::INVALID_BUFFER,
|
Codes::INVALID_BUFFER,
|
||||||
"w/ BufferType " + BufferTypes.at(Target)
|
"w/ BufferType " + BufferTypes.at(Target)
|
||||||
));
|
), 0xFE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void unbind() const override { glBindBuffer(Target, 0); }
|
virtual void unbind() const override { glBindBuffer(Target, 0); }
|
||||||
|
|||||||
@ -17,7 +17,13 @@ const ErrorCodeMap ProgramError::ErrorMessages = {
|
|||||||
|
|
||||||
Shader::Shader(GLenum target_, const std::string& source_) : target(target_) {
|
Shader::Shader(GLenum target_, const std::string& source_) : target(target_) {
|
||||||
declare();
|
declare();
|
||||||
|
const char* src_ptr= source_.data();
|
||||||
|
glShaderSource(_id, 1, &src_ptr, NULL);
|
||||||
|
glCompileShader(_id);
|
||||||
_success = status(GL_COMPILE_STATUS);
|
_success = status(GL_COMPILE_STATUS);
|
||||||
|
if (!_success) {
|
||||||
|
WARN(log(), 0x0FE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader::Shader(Shader&& cpy) : target(cpy.target) {
|
Shader::Shader(Shader&& cpy) : target(cpy.target) {
|
||||||
@ -49,7 +55,7 @@ Program::Program(SharedVector<Shader> shaders_) {
|
|||||||
glLinkProgram(_id);
|
glLinkProgram(_id);
|
||||||
_success = status(GL_LINK_STATUS);
|
_success = status(GL_LINK_STATUS);
|
||||||
if (!_success) {
|
if (!_success) {
|
||||||
WARN(log(), 0x01);
|
WARN(log(), 0x0FE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
nb::logger.log("Howdy!");
|
nb::logger.log("Howdy!");
|
||||||
nb::Window window(200, 200, "Hello!");
|
nb::Window window(400, 400, "Hello!");
|
||||||
window.setWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
window.setWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
window.setWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
window.setWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
window.init();
|
window.init();
|
||||||
@ -56,6 +56,10 @@ int main() {
|
|||||||
GLFWwindow* window_ptr = window.getWindow();
|
GLFWwindow* window_ptr = window.getWindow();
|
||||||
while(!glfwWindowShouldClose(window_ptr)) {
|
while(!glfwWindowShouldClose(window_ptr)) {
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
glfwPollEvents();
|
||||||
|
glfwSwapBuffers(window_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user