Ejemplo n.º 1
0
	def index(self):
		'''The uniform index of the block member. Will return :py:obj:`None` if it is not a resource
		(i.e. a :py:class:`.Struct` type) , or if it is not active.

		:rtype: :py:obj:`int` or :py:obj:`None`
		'''
		if isinstance(getattr(self.datatype, 'base', self.datatype), Struct):
			return None

		names = c.pointer(c.c_char_p(self.api_name.encode()))
		names = c.cast(names, c.POINTER(c.POINTER(c.c_char)))

		out = GL.GLuint()
		GL.glGetUniformIndices(self.program.handle, 1, names, c.byref(out))
		return out.value if out.value != GL.GLuint(GL.GL_INVALID_INDEX).value else None