Welcome to Python-flavored Magnum! Please note that, while already being
rather stable, this functionality is still considered experimental and
some APIs might get changed without preserving full backwards compatibility.
class
PhongGLPhong OpenGL shader
Enums
- class Flags: AMBIENT_TEXTURE = 1 DIFFUSE_TEXTURE = 2 SPECULAR_TEXTURE = 4 NORMAL_TEXTURE = 16 ALPHA_MASK = 8 VERTEX_COLOR = 32 BITANGENT = 2048 TEXTURE_TRANSFORMATION = 64 INSTANCED_TRANSFORMATION = 512 INSTANCED_TEXTURE_OFFSET = 1088 NONE = 0
- Flags
Methods
- def bind_ambient_texture(self, arg0: gl.Texture2D, /) -> None
- Bind an ambient texture
- def bind_diffuse_texture(self, arg0: gl.Texture2D, /) -> None
- Bind a diffuse texture
- def bind_normal_texture(self, arg0: gl.Texture2D, /) -> None
- Bind a normal texture
- def bind_specular_texture(self, arg0: gl.Texture2D, /) -> None
- Bind a specular texture
- def bind_textures(self, ambient: gl.Texture2D = None, diffuse: gl.Texture2D = None, specular: gl.Texture2D = None, normal: gl.Texture2D = None) -> None
- Bind textures
- def draw(self, arg0: gl.Mesh, /) -> None
- Draw a mesh
- def validate(self, /) -> tuple[bool, str]
- Validate program
Special methods
- def __init__(self, *, flags: Flags = Flags.NONE, light_count: int = 1) -> None
- Constructor
Properties
- alpha_mask: float set
- Alpha mask
- ambient_color: Color4 set
- Ambient color
- diffuse_color: Color4 set
- Diffuse color
- flags: Flags get
- Flags
- id: int get
- OpenGL program ID
- light_colors: list[Color3] set
- Light colors
- light_count: int get
- Light count
- light_positions: list[Vector4] set
- Light positions
- light_ranges: list[float] set
- Light ranges
- light_specular_colors: list[Color3] set
- Light specular colors
- normal_matrix: Matrix3x3 set
- Normal matrix
- normal_texture_scale: float set
- Normal texture scale
- projection_matrix: Matrix4 set
- Projection matrix
- shininess: float set
- Shininess
- specular_color: Color4 set
- Specular color
- texture_matrix: Matrix3 set
- Texture matrix
- transformation_matrix: Matrix4 set
- Transformation matrix
Data
- BITANGENT: gl.Attribute
- Bitangent direction
- COLOR3: gl.Attribute
- Three-component vertex color
- COLOR4: gl.Attribute
- Four-component vertex color
- NORMAL: gl.Attribute
- Normal direction
- NORMAL_MATRIX
- (Instanced) normal matrix
- POSITION: gl.Attribute
- Vertex position
- TANGENT: gl.Attribute
- Tangent direction
- TANGENT4: gl.Attribute
- Tangent direction with a bitangent sign
- TEXTURE_COORDINATES: gl.Attribute
- 2D texture coordinates
- TEXTURE_OFFSET: gl.Attribute
- (Instanced) texture offset
- TRANSFORMATION_MATRIX: gl.Attribute
- (Instanced) transformation matrix
- TransformFeedbackBufferMode
- attach_shader
- bind_attribute_location
- bind_fragment_data_location
- bind_fragment_data_location_indexed
- dispatch_compute
- link
- retrievable_binary
- separable
- set_uniform
- set_uniform_block_binding
- uniform_block_index
- uniform_location
Method documentation
def magnum. shaders. PhongGL. bind_ambient_texture(self,
arg0: gl.Texture2D, /) -> None
Bind an ambient texture
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.AMBIENT_TEXTURE |
def magnum. shaders. PhongGL. bind_diffuse_texture(self,
arg0: gl.Texture2D, /) -> None
Bind a diffuse texture
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.DIFFUSE_TEXTURE |
def magnum. shaders. PhongGL. bind_normal_texture(self,
arg0: gl.Texture2D, /) -> None
Bind a normal texture
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.NORMAL_TEXTURE |
def magnum. shaders. PhongGL. bind_specular_texture(self,
arg0: gl.Texture2D, /) -> None
Bind a specular texture
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.SPECULAR_TEXTURE |
def magnum. shaders. PhongGL. bind_textures(self,
ambient: gl.Texture2D = None,
diffuse: gl.Texture2D = None,
specular: gl.Texture2D = None,
normal: gl.Texture2D = None) -> None
Bind textures
Exceptions | |
---|---|
AttributeError | If the shader was not created with any of Flags.AMBIENT_TEXTURE, Flags.DIFFUSE_TEXTURE, Flags.SPECULAR_TEXTURE or Flags.NORMAL_TEXTURE |
Property documentation
magnum. shaders. PhongGL. alpha_mask: float set
Alpha mask
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.ALPHA_MASK |
magnum. shaders. PhongGL. light_colors: list[Color3] set
Light colors
Exceptions | |
---|---|
ValueError | If list length is different from light_count |
magnum. shaders. PhongGL. light_positions: list[Vector4] set
Light positions
Exceptions | |
---|---|
ValueError | If list length is different from light_count |
magnum. shaders. PhongGL. light_ranges: list[float] set
Light ranges
Exceptions | |
---|---|
ValueError | If list length is different from light_count |
magnum. shaders. PhongGL. normal_texture_scale: float set
Normal texture scale
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.NORMAL_TEXTURE |
magnum. shaders. PhongGL. texture_matrix: Matrix3 set
Texture matrix
Exceptions | |
---|---|
AttributeError | If the shader was not created with Flags.TEXTURE_TRANSFORMATION |