Package dev.prozilla.pine.core.rendering
Class Shader
java.lang.Object
dev.prozilla.pine.core.rendering.Shader
- All Implemented Interfaces:
Asset,Destructible
Represents an OpenGL shader.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionShader(int type) Creates a shader with specified type.Shader(Shader.Type type) -
Method Summary
Modifier and TypeMethodDescriptionvoidcompile()Compiles the shader and checks its status afterward.static ShadercreateShader(int type, CharSequence source) Creates a shader with specified type and source and compiles it.static ShadercreateShader(Shader.Type type, CharSequence source) Creates a shader with specified type and source and compiles it.static Stringvoiddestroy()Deletes the shader.intgetId()Getter for the shader ID.getPath()Returns the path to the file this asset was loaded from.voidvoidsetSource(CharSequence source) Sets the source code of this shader.
-
Constructor Details
-
Shader
-
Shader
public Shader(int type) Creates a shader with specified type.- Parameters:
type- Type of the shader
-
-
Method Details
-
setSource
Sets the source code of this shader.- Parameters:
source- GLSL Source Code for the shader
-
compile
public void compile()Compiles the shader and checks its status afterward. -
destroy
public void destroy()Deletes the shader.- Specified by:
destroyin interfaceAsset- Specified by:
destroyin interfaceDestructible
-
getId
public int getId()Getter for the shader ID.- Returns:
- Handle of this shader
-
getPath
Description copied from interface:AssetReturns the path to the file this asset was loaded from. -
setPath
-
createShader
Creates a shader with specified type and source and compiles it.- Parameters:
type- Type of the shadersource- Source of the shader- Returns:
- Compiled Shader from the specified source
-
createShader
Creates a shader with specified type and source and compiles it.- Parameters:
type- Type of the shadersource- Source of the shader- Returns:
- Compiled Shader from the specified source
-
define
-