mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
opengl: print out current state on error (buffers)
This commit is contained in:
parent
c1dfc10ea2
commit
4aee5d15ae
@ -50,7 +50,7 @@ abstract class OpenGLRenderableBuffer(
|
||||
}
|
||||
|
||||
override fun unload() {
|
||||
check(state == RenderableBufferStates.UPLOADED) { "Can not unload $state buffer!" }
|
||||
check(state == RenderableBufferStates.UPLOADED) { "Buffer is not uploaded: $state" }
|
||||
glDeleteBuffers(id)
|
||||
if (renderSystem.boundBuffer == id) {
|
||||
renderSystem.boundBuffer = -1
|
||||
|
@ -53,12 +53,13 @@ class OpenGLFramebuffer(var size: Vec2i) : Framebuffer {
|
||||
//depthTexture.init()
|
||||
//attach(depthTexture)
|
||||
|
||||
check(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) { "Framebuffer is incomplete!" }
|
||||
state = FramebufferState.COMPLETE
|
||||
val state = glCheckFramebufferStatus(GL_FRAMEBUFFER)
|
||||
check(state == GL_FRAMEBUFFER_COMPLETE) { "Framebuffer is incomplete: $state" }
|
||||
this.state = FramebufferState.COMPLETE
|
||||
}
|
||||
|
||||
fun bind() {
|
||||
check(state == FramebufferState.COMPLETE) { "Framebuffer is incomplete!" }
|
||||
check(state == FramebufferState.COMPLETE) { "Framebuffer is incomplete: $state" }
|
||||
unsafeBind()
|
||||
}
|
||||
|
||||
@ -80,14 +81,14 @@ class OpenGLFramebuffer(var size: Vec2i) : Framebuffer {
|
||||
}
|
||||
|
||||
override fun delete() {
|
||||
check(state == FramebufferState.COMPLETE) { "Framebuffer is incomplete!" }
|
||||
check(state == FramebufferState.COMPLETE) { "Framebuffer is incomplete: $state" }
|
||||
glDeleteFramebuffers(id)
|
||||
id = -1
|
||||
state = FramebufferState.DELETED
|
||||
}
|
||||
|
||||
override fun bindTexture() {
|
||||
check(state == FramebufferState.COMPLETE) { "Framebuffer is incomplete!" }
|
||||
check(state == FramebufferState.COMPLETE) { "Framebuffer is incomplete: $state" }
|
||||
colorTexture.bind(0)
|
||||
if (this::depthTexture.isInitialized) {
|
||||
depthTexture.bind(1)
|
||||
|
@ -73,7 +73,7 @@ class FloatOpenGLVertexBuffer(
|
||||
}
|
||||
|
||||
override fun draw() {
|
||||
check(state == RenderableBufferStates.UPLOADED) { "Can not draw $state vertex buffer!" }
|
||||
check(state == RenderableBufferStates.UPLOADED) { "Vertex buffer is not uploaded: $state" }
|
||||
bindVao()
|
||||
glDrawArrays(primitiveType.gl, 0, vertices)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user