diff --git a/Diya/Diya2DPrimShape.class.st b/Diya/Diya2DPrimShape.class.st index 7320b09..965e926 100644 --- a/Diya/Diya2DPrimShape.class.st +++ b/Diya/Diya2DPrimShape.class.st @@ -32,14 +32,11 @@ Diya2DPrimShape >> draw [ context texture0 setImage2D: self texture. context texture0 active. ]. - context vao enableAttribute: 0. - OpenGLVertexArray vertexAttributePointerIndex: 0 size:4 type: GL_FLOAT normalized: GL_FALSE stride: 16 pointer: nil. context vbo data: GL_ARRAY_BUFFER data: vbuffer usage: GL_DYNAMIC_DRAW. OpenGL drawArrays: type first:0 count:((vbuffer size )>> 2 ). "reset value" self texture ifNotNil: [self texture drop.]. self borderWidth > 0 ifTrue: [ self drawBorder ]. - context vao disableAttribute: 0. OpenGL disable: GL_CULL_FACE; disable: GL_BLEND. diff --git a/Diya/DiyaRendererContext.class.st b/Diya/DiyaRendererContext.class.st index 414b990..832f103 100644 --- a/Diya/DiyaRendererContext.class.st +++ b/Diya/DiyaRendererContext.class.st @@ -41,6 +41,7 @@ DiyaRendererContext >> assets: anObject [ { #category : #accessing } DiyaRendererContext >> destroy [ + vao disableAttribute: 0. vao delete. vbo delete. texture0 delete. @@ -66,6 +67,8 @@ DiyaRendererContext >> initialize [ vbo bind: GL_ARRAY_BUFFER. projection := Array2D identity: 4. assets := AssetManager new. + vao enableAttribute: 0. + OpenGLVertexArray vertexAttributePointerIndex: 0 size:4 type: GL_FLOAT normalized: GL_FALSE stride: 16 pointer: nil. ] { #category : #accessing } diff --git a/Diya/DiyaRootNode.class.st b/Diya/DiyaRootNode.class.st index e4004ae..4ef80fd 100644 --- a/Diya/DiyaRootNode.class.st +++ b/Diya/DiyaRootNode.class.st @@ -28,7 +28,7 @@ DiyaRootNode >> draw [ c := self ? #bgColor. OpenGL clearColorR: c red G: c green B: c blue A: c alpha. OpenGL clear: GL_COLOR_BUFFER_BIT. - context vbo bind: GL_ARRAY_BUFFER. + "context vbo bind: GL_ARRAY_BUFFER." ] { #category : #'add/remove' } diff --git a/Diya/OpenGLVertexBuffer.class.st b/Diya/OpenGLVertexBuffer.class.st index 14c3f80..7886fdf 100644 --- a/Diya/OpenGLVertexBuffer.class.st +++ b/Diya/OpenGLVertexBuffer.class.st @@ -51,24 +51,24 @@ OpenGLVertexBuffer class >> subData:target offset: offset size: size data: data ^self ffiCall: #(void glBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void * data)) ] -{ #category : #'as yet unclassified' } +{ #category : #initialization } OpenGLVertexBuffer >> bind: target [ ^OpenGLVertexBuffer bind:target buffer: self vertexBufferID ] -{ #category : #'as yet unclassified' } +{ #category : #'accessing - data' } OpenGLVertexBuffer >> data:target data: data size: size usage: usage [ - self bind: target. + "self bind: target." ^OpenGLVertexBuffer bufferData: target size: size data:(data ifNil:[data] ifNotNil: [data getHandle]) usage: usage ] -{ #category : #'as yet unclassified' } +{ #category : #'accessing - data' } OpenGLVertexBuffer >> data:target data: data usage: usage [ - self bind: target. + "self bind: target." ^OpenGLVertexBuffer bufferData: target size: (data size) << 2 data:data getHandle usage: usage ] -{ #category : #'as yet unclassified' } +{ #category : #'add/remove' } OpenGLVertexBuffer >> delete [ OpenGLVertexBuffer deleteBuffersSize: 1 buffers: vertexBufferID getHandle. ] @@ -81,15 +81,15 @@ OpenGLVertexBuffer >> initialize [ OpenGLVertexBuffer genVertexBuffersSize: 1 buffers: vertexBufferID getHandle ] -{ #category : #'as yet unclassified' } +{ #category : #'accessing - data' } OpenGLVertexBuffer >> subData:target offset: offset data:data [ - self bind: target. + "self bind: target." ^OpenGLVertexBuffer subData: target offset: offset size: (data size) << 2 data: data getHandle ] -{ #category : #'as yet unclassified' } +{ #category : #'accessing - data' } OpenGLVertexBuffer >> subData:target offset: offset data:data size: size [ - self bind: target. + "self bind: target." ^OpenGLVertexBuffer subData: target offset: offset size: size data: data getHandle ]