Ejemplo n.º 1
0
    data += struct.pack('3f', x, y, z + height)
    data += struct.pack('3f', math.cos(a), math.sin(a), 0)
    data += struct.pack('3f', r, g, b)
    data += struct.pack('1f', 0)
    data += struct.pack('1f', d)

idata = b''

for k in range(1000):
    idata += struct.pack(
        '%di' % (step + 3),
        *([k * (step + 2) + i for i in range(step + 2)] + [-1]))

vbo = GL.NewVertexBuffer(data)
ibo = GL.NewIndexBuffer(idata)

vao = GL.NewVertexArray(grass_prog, vbo, '3f3f3f1f1f',
                        ['vert', 'direction', 'color', 'thickness', 'power'],
                        ibo)

ssao_vbo = GL.NewVertexBuffer(
    struct.pack('8f', 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0))
ssao_vao = GL.NewVertexArray(ssao_prog, ssao_vbo, '2f', ['vert'])

ubo = GL.NewUniformBuffer(b''.join(struct.pack('2f', x, y) for x, y in kernel))

fbo, color, depth = GL.NewFramebuffer()

GL.SetUniform(grass_prog['mat'], struct.pack('16f', *camera))
GL.SetUniform(ssao_prog['texture'], 0)
Ejemplo n.º 2
0
GL.DisableBlend()
GL.DisableCullFace()
GL.DisableDepthTest()
GL.DisableMultisample()

GL.EnableBlend()
GL.EnableCullFace()
GL.EnableDepthTest()
GL.EnableMultisample()

GL.NewAdvancedVertexArray()
GL.NewFragmentShader()
GL.NewFramebuffer()
GL.NewGeometryShader()
GL.NewIndexBuffer()
GL.NewProgram()
GL.NewTessControlShader()
GL.NewTessEvaluationShader()
GL.NewTexture()
GL.NewUniformBuffer()
GL.NewVertexArray()
GL.NewVertexBuffer()
GL.NewVertexShader()

GL.ReadPixel()
GL.ReadPixels()

GL.ReadDepthPixel()
GL.ReadDepthPixels()