Search in sources :

Example 1 with GLProgramInfo

use of maspack.render.GL.GLProgramInfo in project artisynth_core by artisynth.

the class GL3ProgramManager method createDefaultProgram.

/**
 * Creates a program containing all uniforms, for binding purposes
 * @param gl
 */
protected void createDefaultProgram(GL3 gl) {
    GLProgramInfo info = new GLProgramInfo();
    info.setNumLights(numLights);
    info.setNumClipPlanes(numClipPlanes);
    info.setMode(RenderingMode.DEFAULT);
    info.setShading(Shading.SMOOTH);
    info.setVertexNormalsEnabled(true);
    info.setVertexColorsEnabled(true);
    info.setVertexTexturesEnabled(true);
    info.setVertexColorMixing(ColorMixing.REPLACE);
    info.setTextureColorMixing(ColorMixing.MODULATE);
    createAndBindProgram(gl, info);
}
Also used : GLProgramInfo(maspack.render.GL.GLProgramInfo)

Example 2 with GLProgramInfo

use of maspack.render.GL.GLProgramInfo in project artisynth_core by artisynth.

the class GL3ProgramManager method getSelectionProgram.

public GLShaderProgram getSelectionProgram(GL3 gl, GLProgramInfo info) {
    // basic flat program
    GLProgramInfo select = new GLProgramInfo();
    // use rounded points by default
    select.setSelecting(true);
    RenderingMode mode = info.getMode();
    if (mode == RenderingMode.POINTS) {
        select.setRoundPointsEnabled(info.hasRoundPoints());
    }
    select.setMode(mode);
    select.setNumLights(0);
    select.setNumClipPlanes(numClipPlanes);
    // disable everything else
    select.setVertexColorsEnabled(false);
    select.setVertexNormalsEnabled(false);
    select.setVertexTexturesEnabled(false);
    select.setInstanceColorsEnabled(false);
    select.setLineColorsEnabled(false);
    select.setShading(Shading.NONE);
    return getProgram(gl, select);
}
Also used : RenderingMode(maspack.render.GL.GLProgramInfo.RenderingMode) GLProgramInfo(maspack.render.GL.GLProgramInfo)

Example 3 with GLProgramInfo

use of maspack.render.GL.GLProgramInfo in project artisynth_core by artisynth.

the class GLSLGenerator method main.

public static void main(String[] args) {
    GLProgramInfo info = new GLProgramInfo();
    info.setNumLights(1);
    info.setShading(Shading.SMOOTH);
    String[] shaders = getShaderScripts(info);
    System.out.println("Vertex Shader: ");
    System.out.println(shaders[VERTEX_SHADER]);
    System.out.println("Fragment Shader: ");
    System.out.println(shaders[FRAGMENT_SHADER]);
}
Also used : GLProgramInfo(maspack.render.GL.GLProgramInfo)

Example 4 with GLProgramInfo

use of maspack.render.GL.GLProgramInfo in project artisynth_core by artisynth.

the class GL3JPanelTest method initPrograms.

private void initPrograms(GL3 gl) {
    // Shaders
    String vertexShaderSource = "#version 330 core\n" + "layout (location = 0) in vec3 position;\n" + "void main()\n" + "{\n" + "   gl_Position = vec4(position.x, position.y, position.z, 1.0);\n" + "}";
    String fragmentShaderSource = "#version 330 core\n" + "out vec4 color;\n" + "void main()\n" + "{\n" + "   color = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n" + "}\n";
    // default program that has matrices, etc...
    progManager.getProgram(gl, new GLProgramInfo());
    // basic debug program
    progManager.getProgram(gl, this, new String[] { vertexShaderSource, fragmentShaderSource });
}
Also used : GLProgramInfo(maspack.render.GL.GLProgramInfo)

Aggregations

GLProgramInfo (maspack.render.GL.GLProgramInfo)4 RenderingMode (maspack.render.GL.GLProgramInfo.RenderingMode)1