File: test_glgetactiveuniform.py

package info (click to toggle)
pyopengl 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,184 kB
  • ctags: 21,473
  • sloc: python: 80,468; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys, pygame
from math import sin
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GL.shaders import *
from OpenGL.GL.ARB.shader_objects import glGetActiveUniformARB

vertex_shader = """
uniform float scale;
void main(void)
{
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex * scale;
}
"""

pygame.init()
disp = pygame.display.set_mode((1024, 768), OPENGL | DOUBLEBUF)

program = compileProgram(
    compileShader( vertex_shader, GL_VERTEX_SHADER )
)

nu = glGetProgramiv(program, GL_ACTIVE_UNIFORMS)
for i in range(nu):
    name, size, type = glGetActiveUniform(program, i)
    print('CORE - ', name, size, type)
    glGetActiveUniformARB( program, i )
    print('ARB  - ', name, size, type)