Login  Register

Re: Need Help Solving OpenGL/GLSL 4.4 Issues

Posted by Sven Gothel on Jul 15, 2014; 12:02pm
URL: https://forum.jogamp.org/Need-Help-Solving-OpenGL-GLSL-4-4-Issues-tp4032557p4032574.html

On 07/15/2014 01:45 PM, xghost [via jogamp] wrote:

> I've enabled GL_DEPTH_TEST in the init(GLAutoDrawable drawable) method:
>
>     gl = (GL4) drawable.getGL();
>     gl.glEnable(GL4.GL_DEPTH_TEST);
>     gl.glClearColor(0.0f, 0.0f, 1.0f, 1.0f);    // added to replace
> gl.glClearBufferfv(...) below
>
> I then added the clear in the display(GLAutoDrawable) method, trying a few
> different things:
>
>     gl = (GL4) drawable.getGL();
>     gl.glClear(GL4.GL_DEPTH_BUFFER_BIT | GL4.GL_COLOR_BUFFER_BIT);
>     // gl.glClearBufferfv(GL4.GL_COLOR, 0, bufferClearColor);
>     gl.glUseProgram(program);
>
> I'm still getting the same result as before --the blue-cleared background w/
> no triangle. This is even if I don't use glClearColor() on init and instead
> keep using glClearBufferfv() that's currently commented out and only clearing
> the depth buffer bit, not the color buffer bit.
>
> Also, looking at the C++ code from the OpenGL SB 6 (movingtri application),
> which builds/works fine, the render code is as follows:
>
>     virtual void render(double currentTime)
>     {
>         static const GLfloat green[] = { 0.0f, 0.25f, 0.0f, 1.0f };
>         glClearBufferfv(GL_COLOR, 0, green);
>         glUseProgram(program);
>
>         GLfloat attrib[] = { (float)sin(currentTime) * 0.5f,
>                              (float)cos(currentTime) * 0.6f,
>                              0.0f, 0.0f };
>
>         glVertexAttrib4fv(0, attrib);
>         glDrawArrays(GL_TRIANGLES, 0, 3);
>     }
>
> This is equivalent to the Java code I included.
>
> On the coords topic, perhaps I'm missing something, but the range of the NDC
> and depth range values seems to be within the valid/accepted range (i.e.
> within [-1,1] and [0, 1] respectively) in my application.
Hmm..

Can you please provide a complete tar ball w/ your latest test code ?

Best ofc if you would add a unit test for JOGL,
provided as a git-patch or accessible via a public git repository.
Then I would not need to do it :)

I will test you code then .. surely interesting.

~Sven

--
health & wealth
mailto:[hidden email] ; http://jausoft.com
land : +49 (471) 4707742 ; fax : +49 (471) 4707741
Timezone CET: PST+9, EST+6, UTC+1


signature.asc (894 bytes) Download Attachment