Misleading documentation regarding shader objects

Hello all,

I have had a problem with coworkers and myself using the GLSLShaderObjectsState (com.jme.scene.state) "load" method that takes strings rather than the URL version. The problem is that the string overload is implemented by LWJGLShaderObjectsState to parse the strings as though they contain actual source, rather than reading source code from the specified file. After I found this problem, it was easy to spot and correct when it popped up. After about the fifth time this popped up, I decided to look down into the source and found that the actual documentation for the GLSLShaderObjectsState says:

/**
     * <code>load</code> loads the shader object from the specified file. The
     * program must be in ASCII format. We delegate the loading to each
     * implementation because we do not know in what format the underlying API
     * wants the data.
     *
     * @param vert text file containing the vertex shader object
     * @param frag text file containing the fragment shader object
     */



Then when I looked at the implementation of this method in LWJGLShaderObjectsState I found:

 /**
     * Loads the shader object. Use null for an empty vertex or empty fragment
     * shader.
     *
     * @param vert vertex shader
     * @param frag fragment shader
     * @see com.jme.scene.state.GLSLShaderObjectsState#load(java.net.URL,
     *java.net.URL)
     */
    public void load(String vert, String frag) {
        ByteBuffer vertexByteBuffer = vert != null ? load(vert) : null;
        ByteBuffer fragmentByteBuffer = frag != null ? load(frag) : null;
        load(vertexByteBuffer, fragmentByteBuffer);
    }


The ByteBuffer version of the load method that is called here directly parses the ByteBuffers. See LWJGLShaderObjectsState.java for more info.


This could be very confusing for others...

Thanks!

Thanks for the heads up :slight_smile:

I think it would be best to post these things also in the issue list on google code. The dev team is a bit in a flux at the moment and otherwise this kind of threads might slump into oblivion and you would just get frustrated 2 months down the road when nothing has changed…



jME 2.0 issues on google code