Login  Register

Re: Texture rendering performance problems

Posted by Matteo Battaglio on Jul 26, 2010; 5:38pm
URL: https://forum.jogamp.org/Texture-rendering-performance-problems-tp966089p996985.html

Demoscene Passivist wrote
I thought u had kicked GLJPanel in favor of a GLCanvas based solution, but ur screenshot shows me ur using Swing/GLJPanel ?!
I developed this test to see if using a GLJPanel with the options you suggested could be a possible solution, but those options give me problems like that on the screenshot, and also they causes the application to crash on the resize of the panel/canvas (even after having commented the code in the reshape() callback).

Maybe the bottleneck lies in the composition of these bytebuffers ? Ever tried "Visual VM" (https://visualvm.dev.java.net/) to profile ur application ? If u don't profile u'll never really know where the bottleneck lies ...
The byteBuffers are allocated once, passed to the decoder via JNI and then returned already filled by the decoder.
Of course I profiled my app with VisualVM and also by putting lots of System.nanoTime() calls in the display method, and between the call to repaint() and the subsequent display(), and it seems that while the display() code is really fast, a lot of time elapses between repaint and display; anyway none of the profiled methods seems to be the guilty one, hence my assumption that the problem doesn't lie on the java-side.

Yep they are two different things. But as u aren't using Java2D my link doesnt matter for what u wanna do. If u go 100% OpenGL u should definitly check out this paper from NVidia: http://developer.nvidia.com/object/fast_texture_transfers.html
I read that paper and followed this suggestion you gave me:
>To test if the problem lies in a wrong texture format simply change the glTexImage2D to use GL_RGBA.
>The video will be fucked up but performance should greatly increase. If so u know thats most likely the problem.
using the parameters suggested by Sven Gothel in every call to glTexImage2D, but the CPU load was still very high... surely using RGBA will improve performance, and I'll be changing the output of the decoder from RGB to RGBA, but i'm quite sure that the DMA problem still is the main responsible of the high CPU usage.

As much as I love OpenGL and JOGL but it seems to me that u are only doing 2D stuff ? So the question arises why are u using JOGL at all ? If I were writing a pure 2D video surveillance application I would use Java2D. It would save u a lot of trouble ... just my 2 cents :)
Before trying with JOGL I tried a lot of other ways: I printed and read the tutorial Painting in AWT and Swing, learned about Buffered/VolatileImages, double bufering, drawing to offscreen images, etc; I tried to build a VolatileImage using custom Raster/ColorModel/DataBuffer which used my native ByteBuffer (there seems to be no simpler way to create an Image backed by a ByteBuffer), but I wasn't able to achieve a decent performance, even compared with non-hw-accelerated jogl panel.

Maybe there's a simpler solution than using JOGL+PBOs - and it's really possible, since I can define myself a noob in awt/swing/java2D programming - but I wasn't able to find it :-/