<AWT Dev> AWT OpenGL context

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Oct 19 14:56:44 UTC 2016


Hi,

On 16.10.16 3:44, Link TheProgrammer wrote:
> To the developers of AWT,
> >
> There will eventually be an AWTDisplay implementation, but for the
> meantime, I would like to know the details regarding how AWT handles
> contexts created with java.awt.Window so that I might retrieve the
> context for a Window.
>
> What I need specifically is a brief explanation of how AWT initializes
> the OpenGL context and the source file that this occurs. If this occurs
> outside the main thread of a JAR application, I need to know which one.

This is mostly related to Java2D and you can start from the OGLContext 
class(which is created in a different implementations of 
OGLGraphicsConfig = WGLGraphicsConfig/GLXGraphicsConfig/CGLGraphicsConfig)
When Java2D uses OpenGL pipeline then the special OGLRenderQueue thread 
is created. So when you try to draw something to the window or to the 
VolatileImage the actual commands will be placed to the special buffer. 
Some time later these commands are executed in the native code(see 
OGLRenderQueue.c)
The list of commands located in  sun.java2d.pipe.BufferedOpCodes class. 
Note that each of them have a different parameters.

Note that by default OGL pipeline is enabled on OSX only.

> For interacting with the context that AWT has created, that is already
> satisfied, as the capabilities, as far as I can see, are software
> abstractions, and LWJGL simply tries to get the version using GL
> function calls directly (otherwise they fail). I can implement my own
> Graphics2D using LWJGL bindings and the context provided by an AWT
> Window object in order to properly create a canvas for AWT,  and will
> also be more efficient than SunGraphics2D.
>
> I know I am asking for a lot, and if I must, I will painstakingly look
> through the "intermingled" mess that is AWT. I wouldn't be asking if AWT
> was more straightforward.
>
> Sincerely,
>
> Andrew Porter
>
>
> --
> Sent from Gmail Mobile


-- 
Best regards, Sergey.


More information about the awt-dev mailing list