Non-game use of JOGL - OGL newcomer needs help

Hi,

I’m currently trying to write the following application:
There are various input sources. Each has an ARGB integer buffer and parts of them change throughout execution. The central thread, for each of these updates, fills in the relevant parts of various output buffers of the same format, using a perspective transform specified by a matrix (two-dimensional array of doubles) to work out the colour of the relevant output pixels.

At the moment, the program uses JAMA to calculate the transform and then just simply does a lot of multiplication.

What I’d like to know is, is there any way of doing this faster with OpenGL, or some other technology? I’ve read a little bit about render-to-texture and pixel buffers but as far as I can see, they all involve too much copying and / or are too complicated.

Don’t forget, I’m new to JOGL so only know the basics! Thanks very much in advance.

Could you go into more detail about how you go from input to output? It doesn’t make sense to me that you’d be transforming color data by a perspective transformation. Also, what do you mean by “relevant parts of the output buffers”? Are these parts determined by the perspective transform? or is it almost a 1-1 mapping from input changes to output changes?

If all you need to do is to multiply input pixels by a matrix to get the output, here is one possible way of doing it:

  1. Create a framebuffer object rendering directly into your output texture (rendering with fbos is very fast)
  2. Write a glsl shader that looks up the color from the input texture, and then multiplies that by the desired matrix for the output color. This color will then be stored within the output texture of the fbo.
  3. To actually render an update, you’d bind your input texture and fbo, bind the special glsl program and render 1 quad that covers the whole output texture.
  4. To save the texture or access the data in-memory, you’d have to copy it from the graphics card.

These topics are more complicated than I described here, but it should hopefully help you on your search. If you’re worried about copying performance, you may want to consider storing the image data in opengl and doing the visualization from there. JOGL will let you display swing components around the opengl area easily.

Also, using opengl in such a way depends greatly on how you need to use the data. If all you need to do is update the visuals frequently, and only save or copy out a few times during the program, the above strategy will work well. If you need in-memory access of the output data for other operations, consider keeping everything in memory. In my experience, copying out a texture takes a few to 10 milliseconds (but it’s been awhile); I don’t know how long it would take do the transforms on the cpu.

HTH

Thank you. I’ll try explaining differently. The user specifies a selection of input sources and output screens, which are arbitrary quadrilaterals, on one big wall in the GUI. The program uses cached matrices (representing perspective transforms) to colour in the pixels of the screens (think of them as real monitors) such that they display the data from the sources directly below them in the correct fashion. The data for the the input and output are stored in buffers. Parts of the sources change throughout the program, sometimes large areas, frequently. When a change occurs, the program calculates which bits of the output buffer need changing. At the moment, the system can’t, for example, deal with a full screen video source, even if the output buffers are fairly small in total size.

Sorry, I’m still confused by it a little bit. Are you projecting the input sources onto the output regions? (e.g. the transform only tells you where to put the colors, not actually changing the color values?).

I think if you posted a screenshot, it would really help me understand your application better.
Finally, are the rapid changes in input because you’re streaming a video file?

From the mental model I’m drawing, I think your app will be benefited by opengl.