Other Shader lib?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Other Shader lib?

Worker
Hello

My Shader setup class works good with sun's lib, but
after migration to jogamp's lib, the shader programs are not
linked correct together. After that, destoying the useless
shader, the program crashes.

I have seen that the 'com.jogamp.opengl.util.glsl.ShaderCode'
says, that the following simple shader code file was not valid.

void main()
{
  gl_position = ftransform();
}
 
Is that a bug?

Reply | Threaded
Open this post in threaded view
|

Re: Other Shader lib?

gouessej
Administrator
Hi!

I don't reproduce your bug whereas I have used a pixel shader and a vertex shader with JOGL 2 recently:
#vertex shader
uniform float mandel_x;
uniform float mandel_y;
uniform float mandel_width;
uniform float mandel_height;
uniform float mandel_iterations;

void main(){
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Other Shader lib?

Worker
Hi

i have found my bug's.
First gl_position is not gl_Position :-)
and after ShaderCode.create(.....) a
separate compile is now required.




   
Reply | Threaded
Open this post in threaded view
|

Re: Other Shader lib?

Sven Gothel
Administrator
In reply to this post by Worker
On Monday, May 16, 2011 12:58:53 am Worker [via jogamp] wrote:

>
> Hello
>
> My Shader setup class works good with sun'd lib, but
> after migration to jogamp's lib the programs are not be
> correct linked together. After that, destoying the useless
> shader, the program crashes.
>
> I have seen that the 'com.jogamp.opengl.util.glsl.ShaderCode'
> says, that the following simple shader code file was not valid.
>
> void main()
> {
>   gl_position = ftransform();
> }
>  
> Is that a bug?

FAQ -> How To Bug Report :)

Well .. I have just added a few more glsl unit tests for JOGLs ShaderState/Utils,
which are now in quite a good shape.

Have a look at them, if you don't mind ..

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: Other Shader lib?

Worker
Hi Sven

A problem is, when ShaderCode.create(.....) must read from an
Url, classpath or jar, then its file reading capacity comes at his end.
E.g. when the souces are in a jar with an applet.

I think a read with a such code sequence    
 'MyClass.class.getResource(filename).openStream()'
is a better solution, instead a file read, that results then in an
acces denied exeption when the applet is not signed.
Reply | Threaded
Open this post in threaded view
|

Re: Other Shader lib?

Sven Gothel
Administrator
On Wednesday, May 18, 2011 09:56:55 pm Worker [via jogamp] wrote:

>
> Hi Sven
>
> I problem is, when ShaderCode.create(.....) must read from an
> Url, classpath or jar, then its file reading capacity comes at his end.
> E.g. when the souces are in a jar with an applet.
>
> I think a read with a such code sequence    
>  'MyClass.class.getResource(filename).openStream()'
> is a better solution, instead a file read, that results then in an
> acces denied exeption when the applet is not signed.
>

Not quite sure if I understand you correctly,
but the URL usually gives you all options .. well, maybe not.

So please feel free to add something diff if you think it helps,
ie InputStream .. will love to review this proposal with it's junit use-case test.

Thank you.

~Sven