Login  Register

Re: Hardware accelelartion using JOGL

Posted by Sven Gothel on Nov 11, 2015; 10:21pm
URL: https://forum.jogamp.org/Hardware-accelelartion-using-JOGL-tp4035755p4035763.html

On 11/11/2015 10:42 AM, Michael F [via jogamp] wrote:

> Hi Julien,
>
> We found out that not rendering images in our app resulted in a 50 percentage
> point reduction in CPU usage. This is the code we commented out :
>
>     public void draw(GL2 gl)
>     {
> /*
>         gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
>         gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
>         gl.glEnable(GL2.GL_TEXTURE_2D);
>         gl.glBindTexture(GL2.GL_TEXTURE_2D, textureId);
>         gl.glEnable(GL2.GL_BLEND);
>
>         gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
>        
>         gl.glColor3f(1, 1, 1);
>         vertexBuffer.position(0);
>         gl.glVertexPointer(2, GL2.GL_FLOAT, 16, vertexBuffer);
>         vertexBuffer.position(2);
>         gl.glTexCoordPointer(2, GL2.GL_FLOAT, 16, vertexBuffer);
>         gl.glDrawArrays(GL2.GL_QUADS, 0, 4);
>
>         gl.glDisable(GL2.GL_BLEND);
>         gl.glBindTexture(GL2.GL_TEXTURE_2D, 0);
>         gl.glDisable(GL2.GL_TEXTURE_2D);
>         gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
>         gl.glDisableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
> */
>     }
>
> Is there anything you can see in here that we could do better ? And yes, we
> are using JVisualVM.
Then you can profile the application and see the culprit
of CPU consumption.

IMHO CPU consumption might be an issue of using the fixed function pipeline
which might be implemented in software using some core GL profile
- by the driver.
Switching those states each frame may also trigger the driver
to issue new 'on the fly shaders' ..

~Sven



signature.asc (828 bytes) Download Attachment