Skip to content

Commit 26f72e9

Browse files
committed
pbo doc
1 parent 1b856ec commit 26f72e9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/src/main/kotlin/com/lambda/graphics/buffer/pixel/PixelBuffer.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import com.lambda.graphics.gl.putTo
2222
import com.lambda.graphics.texture.Texture
2323
import com.lambda.util.math.MathUtils.toInt
2424
import org.lwjgl.opengl.GL45C.*
25-
import java.lang.IllegalStateException
2625
import java.nio.ByteBuffer
2726

2827
/**
@@ -85,9 +84,10 @@ class PixelBuffer(
8584
init {
8685
if (!texture.initialized) throw IllegalStateException("Cannot use uninitialized textures for pixel buffers")
8786

87+
// We can't call the texture's bind method because the animated texture updates the
88+
// data when binding the texture, causing a null pointer exception due to the animated
89+
// texture object not being initialized
8890
glBindTexture(GL_TEXTURE_2D, texture.id)
89-
90-
// Allocate texture storage
9191
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture.width, texture.height, 0, texture.format, GL_UNSIGNED_BYTE, 0)
9292
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
9393
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)

0 commit comments

Comments
 (0)