/** * Create a {@link Program} for the given configuration * * @param withTexture Whether a texture is present * @param withNormals Whether normals are present * @param vertexShaderId The vertex {@link Shader} ID * @param fragmentShaderId The fragment {@link Shader} ID * @return The {@link Program} */ private Program createProgram(boolean withTexture, boolean withNormals, String vertexShaderId, String fragmentShaderId) { Program program = new Program(); program.setVertexShader(vertexShaderId); program.setFragmentShader(fragmentShaderId); List<String> programAttributes = new ArrayList<String>(); programAttributes.add("a_position"); if (withTexture) { programAttributes.add("a_texcoord0"); } if (withNormals) { programAttributes.add("a_normal"); } program.setAttributes(programAttributes); return program; }
/** * Creates a default {@link Program} with the given vertex- and * fragment {@link Shader} IDs, which are assumed to refer to * the {@link Shaders#createDefaultVertexShader() default vertex shader} * and {@link Shaders#createDefaultFragmentShader() default fragment * shader}.<br> * <br> * The returned {@link Program} is the {@link Program} for the default * {@link Material}, as described in "Appendix A" of the * glTF 1.0 specification. * * @param vertexShaderId The vertex {@link Shader} ID * @param fragmentShaderId The fragment {@link Shader} ID * @return The default {@link Program} */ static Program createDefaultProgram( String vertexShaderId, String fragmentShaderId) { Program program = new Program(); program.setVertexShader(vertexShaderId); program.setFragmentShader(fragmentShaderId); program.addAttributes("a_position"); return program; }