Class Shader

java.lang.Object
pl.AWTGameEngine.objects.render.shaders.Shader
Direct Known Subclasses:
BillboardShader, DefaultShader, GUIShader, XRayShader

public abstract class Shader extends Object
Shader class is used to create custom shaders. Every shader instance is a singleton in window area. To obtain shader, use Shaders.of(BaseWindow, Class).
You can use helper methods, such as setFloatValue(int, float) or setFloatMatrixValue(int, float[]), or just use GL context.
For reference, check out DefaultShader or XRayShader shaders.
Shader is compiled before its first use.
Vertex shader layout:
 
 layout(location = 0) in vec3 aPos;
 layout(location = 1) in vec3 normal;
 layout(location = 2) in vec2 aUV;
 
 
  • Method Details

    • use

      public abstract void use(ShaderUseContext useContext)
      Method is invoked everytime an object wants to render.
    • getLocation

      public int getLocation(String name)
    • setFloatValue

      public void setFloatValue(int location, float value)
    • setFloatMatrixValue

      public void setFloatMatrixValue(int location, float[] value)
    • setVec3Value

      public void setVec3Value(int location, Vector3 vector3)
    • setVec3Value

      public void setVec3Value(int location, float x, float y, float z)
    • getName

      public String getName()
    • getProgram

      public int getProgram()
    • setCurrentContext

      public void setCurrentContext(com.jogamp.opengl.GL4 context, BaseWindow window)
    • toString

      public String toString()
      Overrides:
      toString in class Object