1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2024-12-29 04:48:22 +01:00
Diya-API/Diya/DiyaRectangle.class.st
DanyLE 94bfc7f6f0 OpenGL: recalculate vertices only when changed.
This allows to greatly improve rendering performance
2022-03-06 19:50:19 +01:00

29 lines
620 B
Smalltalk

Class {
#name : #DiyaRectangle,
#superclass : #Diya2DPrimShape,
#category : #'Diya-Graphics'
}
{ #category : #accessing }
DiyaRectangle >> initialize [
super initialize.
self extent:10@10.
translation := nil.
vbuffer := FFIExternalArray externalNewType: GLfloat size:24.
vbuffer autoRelease.
nvertices := 6
]
{ #category : #accessing }
DiyaRectangle >> update [
{
0.0. extent y. 0.0. 0.0.
0. 0. 0.0. 1.0.
extent x. 0.0. 1.0. 1.0.
0.0. extent y. 0.0. 0.0.
extent x. 0.0. 1.0. 1.0.
extent x. extent y. 1.0. 0.0.
} doWithIndex: [:e :i| vbuffer at: i put: e].
^true
]