1- import moderngl
21import numpy
2+
3+ import moderngl
34from demosys .opengl import VAO
4- from demosys import context
55
66# Cache fullscreen quad
77QUAD_FS = None
@@ -26,32 +26,32 @@ def quad_2d(width, height, xpos=0.0, ypos=0.0) -> VAO:
2626 :param xpos: Center position x
2727 :param ypos: Center position y
2828 """
29- pos = context . ctx (). buffer ( numpy .array ([
29+ pos = numpy .array ([
3030 xpos - width / 2.0 , ypos + height / 2.0 , 0.0 ,
3131 xpos - width / 2.0 , ypos - height / 2.0 , 0.0 ,
3232 xpos + width / 2.0 , ypos - height / 2.0 , 0.0 ,
3333 xpos - width / 2.0 , ypos + height / 2.0 , 0.0 ,
3434 xpos + width / 2.0 , ypos - height / 2.0 , 0.0 ,
3535 xpos + width / 2.0 , ypos + height / 2.0 , 0.0 ,
36- ], dtype = numpy .float32 ). tobytes ())
36+ ], dtype = numpy .float32 )
3737
38- normals = context . ctx (). buffer ( numpy .array ([
38+ normals = numpy .array ([
3939 0.0 , 0.0 , 1.0 ,
4040 0.0 , 0.0 , 1.0 ,
4141 0.0 , 0.0 , 1.0 ,
4242 0.0 , 0.0 , 1.0 ,
4343 0.0 , 0.0 , 1.0 ,
4444 0.0 , 0.0 , 1.0 ,
45- ], dtype = numpy .float32 ). tobytes ())
45+ ], dtype = numpy .float32 )
4646
47- uvs = context . ctx (). buffer ( numpy .array ([
47+ uvs = numpy .array ([
4848 0.0 , 1.0 ,
4949 0.0 , 0.0 ,
5050 1.0 , 0.0 ,
5151 0.0 , 1.0 ,
5252 1.0 , 0.0 ,
5353 1.0 , 1.0 ,
54- ], dtype = numpy .float32 ). tobytes ())
54+ ], dtype = numpy .float32 )
5555
5656 vao = VAO ("geometry:quad" , mode = moderngl .TRIANGLES )
5757 vao .buffer (pos , '3f' , ["in_position" ])
0 commit comments