Commit ce696c91 authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Provide more details if shaders' initialization fails

parent 4858fc3d
Loading
Loading
Loading
Loading
+18 −10
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ import java.util.List;
import static com.jogamp.opengl.GL.*;
import static com.jogamp.opengl.GL.*;
import static com.jogamp.opengl.GL2ES3.*;
import static com.jogamp.opengl.GL2ES3.*;
import static com.jogamp.opengl.GL3ES3.GL_SHADER_STORAGE_BUFFER;
import static com.jogamp.opengl.GL3ES3.GL_SHADER_STORAGE_BUFFER;
import static com.jogamp.opengl.fixedfunc.GLLightingFunc.*;
import static com.jogamp.opengl.fixedfunc.GLLightingFunc.GL_LIGHTING;
import static com.jogamp.opengl.fixedfunc.GLMatrixFunc.*;
import static com.jogamp.opengl.fixedfunc.GLMatrixFunc.*;


/**
/**
@@ -358,21 +358,29 @@ public class ShadersManager {
     * @throws GLException if either the compilation of some shader or linking a program fails
     * @throws GLException if either the compilation of some shader or linking a program fails
     */
     */
    private void initShaders() {
    private void initShaders() {
        String glslFile = "";
        try {
        try {
            int shadingVsId = Program.compileShader(gl, GL_VERTEX_SHADER, "/shaders/ShadingVS.glsl");
            glslFile = "/shaders/ShadingVS.glsl";
            int shadingFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, "/shaders/ShadingFS.glsl");
            int shadingVsId = Program.compileShader(gl, GL_VERTEX_SHADER, glslFile);
            int colorMixingVsId = Program.compileShader(gl, GL_VERTEX_SHADER, "/shaders/ColorMixingVS.glsl");
            glslFile = "/shaders/ShadingFS.glsl";
            int colorMixingFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, "/shaders/ColorMixingFS.glsl");
            int shadingFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, glslFile);
            int contoursFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, "/shaders/ContoursFS.glsl");
            glslFile = "/shaders/ColorMixingVS.glsl";
            int shadowMapVsId = Program.compileShader(gl, GL_VERTEX_SHADER, "/shaders/ShadowMapVS.glsl");
            int colorMixingVsId = Program.compileShader(gl, GL_VERTEX_SHADER, glslFile);
            int shadowMapFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, "/shaders/ShadowMapFS.glsl");
            glslFile = "/shaders/ColorMixingFS.glsl";
            int colorMixingFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, glslFile);
            glslFile = "/shaders/ContoursFS.glsl";
            int contoursFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, glslFile);
            glslFile = "/shaders/ShadowMapVS.glsl";
            int shadowMapVsId = Program.compileShader(gl, GL_VERTEX_SHADER, glslFile);
            glslFile = "/shaders/ShadowMapFS.glsl";
            int shadowMapFsId = Program.compileShader(gl, GL_FRAGMENT_SHADER, glslFile);


            shadingProgram = new ShadingProgram(gl, shadingVsId, shadingFsId);
            shadingProgram = new ShadingProgram(gl, shadingVsId, shadingFsId);
            colorMixingProgram = new ColorMixingProgram(gl, colorMixingVsId, colorMixingFsId);
            colorMixingProgram = new ColorMixingProgram(gl, colorMixingVsId, colorMixingFsId);
            contoursProgram = new ContourProgram(gl, colorMixingVsId, contoursFsId);
            contoursProgram = new ContourProgram(gl, colorMixingVsId, contoursFsId);
            shadowMapProgram = new ShadowMapProgram(gl, shadowMapVsId, shadowMapFsId);
            shadowMapProgram = new ShadowMapProgram(gl, shadowMapVsId, shadowMapFsId);
        } catch(IOException ex) {
        } catch(GLException|IOException ex) {
            throw new GLException(ex);
            throw new GLException(glslFile + ": " + ex.getMessage(), ex);
        }
        }
    }
    }