Skip to content

Commit

Permalink
Re-use error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvanyo committed Jan 17, 2025
1 parent 9d7f4f0 commit 25520d2
Showing 1 changed file with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import com.alexvanyo.composelife.model.CellWindow
import com.alexvanyo.composelife.model.GameOfLifeState
import com.alexvanyo.composelife.openglrenderer.GameOfLifeShape
import com.alexvanyo.composelife.openglrenderer.GameOfLifeShapeParameters
import com.alexvanyo.composelife.openglrenderer.checkOpenGLError
import com.alexvanyo.composelife.openglrenderer.checkOpenGLFramebufferStatus
import com.alexvanyo.composelife.preferences.CurrentShape
import com.alexvanyo.composelife.ui.mobile.ComposeLifeTheme
import kotlinx.coroutines.flow.collect
Expand Down Expand Up @@ -232,23 +234,3 @@ private fun OpenGLRepro() {
}
}
}

/**
* Throws if there has been an OpenGL error.
*/
fun checkOpenGLError() {
val error = GLES20.glGetError()
if (error != GLES20.GL_NO_ERROR) {
error("OpenGL error: $error")
}
}

/**
* Throws if the framebuffer is not complete.
*/
fun checkOpenGLFramebufferStatus() {
val status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER)
if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
error("OpenGL framebuffer error: $status")
}
}

0 comments on commit 25520d2

Please sign in to comment.