예제 #1
0
	out vec4 color;

	void main() {
		color = vec4(0.04, 0.04, 0.04, 1.0);
	}
''')

prog = GL.NewProgram([vert, frag])

GL.SetUniform(prog['znear'], 0.1)
GL.SetUniform(prog['zfar'], 1000.0)
GL.SetUniform(prog['ratio'], 16 / 9)
GL.SetUniform(prog['fovy'], 60)

GL.SetUniform(prog['eye'], 3, 3, 3)
GL.SetUniform(prog['center'], 0, 0, 0)
GL.SetUniform(prog['up'], 0, 0, 1)

grid = bytes()

for i in range(0, 65):
    grid += struct.pack('6f', i - 32, -32.0, 0.0, i - 32, 32.0, 0.0)
    grid += struct.pack('6f', -32.0, i - 32, 0.0, 32.0, i - 32, 0.0)

vbo = GL.NewVertexBuffer(grid)
vao = GL.NewVertexArray(prog, vbo, '3f', ['vert'])

while WND.Update():
    GL.Clear(240, 240, 240)
    GL.RenderLines(vao, 65 * 4)
예제 #2
0
파일: All.py 프로젝트: Aljenci/ModernGL
GL.NewUniformBuffer()
GL.NewVertexArray()
GL.NewVertexBuffer()
GL.NewVertexShader()

GL.ReadPixel()
GL.ReadPixels()

GL.ReadDepthPixel()
GL.ReadDepthPixels()

GL.ReadStorageBuffer()

GL.RenderLineLoop()
GL.RenderLineStrip()
GL.RenderLines()
GL.RenderPoints()
GL.RenderTriangleFan()
GL.RenderTriangleStrip()
GL.RenderTriangles()

GL.RenderLinesAdjacency()
GL.RenderLineStripAdjacency()
GL.RenderTrianglesAdjacency()
GL.RenderTriangleStripAdjacency()

GL.SetTextureFiltered()
GL.SetTextureMipmapped()
GL.SetTexturePixelated()
GL.SetUniform()
GL.SetUniformMatrix()