2022-03-02 20:11:01 +01:00
|
|
|
Class {
|
|
|
|
#name : #DiyaRectangle,
|
2022-03-06 18:33:10 +01:00
|
|
|
#superclass : #Diya2DPrimShape,
|
2022-03-02 20:11:01 +01:00
|
|
|
#category : #'Diya-Graphics'
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2022-03-03 19:19:40 +01:00
|
|
|
DiyaRectangle >> draw [
|
2022-03-05 11:55:20 +01:00
|
|
|
{
|
2022-03-06 18:33:10 +01:00
|
|
|
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.
|
2022-03-05 11:55:20 +01:00
|
|
|
} doWithIndex: [:e :i| context buffer at: i put: e].
|
2022-03-06 18:33:10 +01:00
|
|
|
texture ifNotNil: [
|
|
|
|
self texture setup.
|
|
|
|
context texture0 setImage2D: self texture.
|
|
|
|
context texture0 active.
|
2022-03-02 20:11:01 +01:00
|
|
|
].
|
|
|
|
context vao enableAttribute: 0.
|
2022-03-06 18:33:10 +01:00
|
|
|
OpenGLVertexArray vertexAttributePointerIndex: 0 size:4 type: GL_FLOAT normalized: GL_FALSE stride: 16 pointer: nil.
|
|
|
|
context vbo subData: GL_ARRAY_BUFFER offset:0 data: context buffer size: 96.
|
|
|
|
OpenGL drawArrays: GL_TRIANGLES first:0 count: 6.
|
2022-03-02 20:11:01 +01:00
|
|
|
context vao disableAttribute: 0.
|
2022-03-06 18:33:10 +01:00
|
|
|
texture ifNotNil: [self texture drop]
|
2022-03-03 19:19:40 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaRectangle >> initialize [
|
|
|
|
super initialize.
|
2022-03-04 20:28:38 +01:00
|
|
|
self extent:10@10.
|
2022-03-03 19:19:40 +01:00
|
|
|
translation := nil.
|
|
|
|
children := nil
|
2022-03-02 20:11:01 +01:00
|
|
|
]
|