Problem with GL4 and glUniformMatrix4dv-Method

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

Problem with GL4 and glUniformMatrix4dv-Method

adi
This post was updated on .
Hello

I can't correct send datas with glUniformMatrix4dv.
The extension isExtensionAvailable("GL_ARB_gpu_shader_fp64") is OK.
I send my datas so:
gl.glUniformMatrix4dv( Shader.modelViewProjectionMatrixLoc, 1, false, modelViewProjectionMatrix, 0);

I have this testet this in little shader, where i set matrices with the same avlue.

#version 420
layout (location=0) in vec3 in_Vertex;
layout (location=1) in vec3 in_Normal;
uniform dmat4 modelViewMatrix;
uniform dmat4 modelViewProjectionMatrix;

out gl_PerVertex {
    vec4  gl_Position;
    float gl_PointSize;
    float gl_ClipDistance[];
};

void main()
{
  dmat4 model = dmat4( 1.0, 0.0,   0.0,  0.0,
                       0.0, 1.0,   0.0,  0.0,
                       0.0, 0.0,   1.0, -8.0,
                       0.0, 0.0,   0.0,  1.0);

  dmat4 view  = dmat4( 1.0, 0.0,   0.0,  0.0,
                       0.0, 1.0,   0.0,  0.0,
                       0.0, 0.0,   1.0, -10.0,
                       0.0, 0.0,   0.0,  1.0);

  dmat4 projection = dmat4(1.3032253728412058,               0.0,             0.0,                  0.0,
                                          0.0, 1.737633830454941,             0.0,                  0.0,
                                          0.0,               0.0, -1.000002000002, -0.20000020000020002,
                                          0.0,               0.0,            -1.0,                  1.0);
  /* This works correct
   gl_Position = mat4(model*view*projection)*vec4(in_Vertex,1.0);*/
 
 /* This does nothing 
  gl_Position = mat4(modelViewProjectionMatrix)*vec4(in_Vertex,1.0);
}

The sendet values for modelViewProjectionMatrix is exact how
model*view*projection does it.

Is there a known bug?
Reply | Threaded
Open this post in threaded view
|

Re: Problem with GL4 and glUniformMatrix4dv-Method

gouessej
Administrator
JOGL is mostly a Java binding for the OpenGL API that wraps native OpenGL methods into Java ones, why does your first reflex consist in assuming that it might be a JOGL bug rather a bug in your own code? If you really suspect it comes from JOGL, please provide a complete test case or try to reproduce it with an existing unit test. As far as I know, JMonkeyEngine 3.0 does something very similar, the matrix representing the product of the model-view matrix and the projection matrix is computed on the CPU side and sent to the GPU with shaders but it uses floats.
Julien Gouesse | Personal blog | Website
adi
Reply | Threaded
Open this post in threaded view
|

Re: Problem with GL4 and glUniformMatrix4dv-Method

adi
No, i sent 2 double Matrices (in this case a model-view matrix and a projection matrix)
and i take 2 double Matrices in the shader.
Before i sent this matrices from the opengl client i have controlled all values in Eclipse
in debug-modus, before i call  the glUniformMatrix4dv-Method, they are the same values
how the the hard-coded matrices in the shader.
Also i make a cast's to floats in the shader,
gl_Position = mat4(model*view*projection)*vec4(in_Vertex,1.0);
or
gl_Position = mat4(modelViewProjectionMatrix)*vec4(in_Vertex,1.0);

so that the correct type is not a problem.
 
P.s. I have not said, the problem does come from jogl.
An implementing bug in my nividea driver can be the problem. I don't no.
The problem exist only with double matrices.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with GL4 and glUniformMatrix4dv-Method

gouessej
Administrator
If the problem doesn't occur with floats, maybe it is a driver bug. Which graphics card do you use? Which driver?
Julien Gouesse | Personal blog | Website
adi
Reply | Threaded
Open this post in threaded view
|

Re: Problem with GL4 and glUniformMatrix4dv-Method

adi
This post was updated on .
Nvidea GTX 590
Driver version 9.18.13.1090
(310.90-desktop-win8-win7-winvista-64bit-international-whql)
(opengl 4.2)
Perhaps i should buy a GTX 690?
or can UBO's be an workaround?
adi
Reply | Threaded
Open this post in threaded view
|

Re: Problem with GL4 and glUniformMatrix4dv-Method

adi
In reply to this post by gouessej
Problem resolved!
I have used uniform blocks,
so that glUniformMatrix4dv-Method
is not needed.