As far as I know there are only 3 base graphics libraries on Windows, the GDI, OpenGL and DirectX, is that correct, so that means that Java, Actionscript and all language use one of these 3 libraries if they are to display graphics, or maybe Java has it's own graphics library/API?


Nick already gave a more specific answer, but I get the sense from your question that you'd benefit from a more generic answer.

Different platforms have various ways of getting pixels to the screen.

Software is written in layers. You can implement OpenGL on top of D3D (like Microsoft has done), or even on top of GDI as software rendering (like Microsoft did in older versions of Windows). It's also common to implement different versions of graphics APIs on top of each other (like OpenGL ES 1.0 on top of OpenGL ES 2.0).

Microsoft also has an old graphics API called WinG, which can work even on the latest Windows versions; the output just goes through GDI instead of through specialized drivers.

Conversely, you can also implement DirectX on top of OpenGL (and there are some such open source projects out there, with WINE including one implementation). And since modern windows uses hardware acceleration for GDI, I wouldn't be surprised if the modern GDI was actually "kind of" implemented on top of DirectX.

Now, we have some cross-platform systems such as Java or WebGL. These generally offer the application developer one (in case of WebGL) or multiple (in case of Java) graphics APIs. What those APIs use to get the pixels on screen depends on the implementation at hand.

For WebGL, Firefox (for instance) actually uses Direct3d as the back-end on Windows. On Linux, I'm pretty sure it uses OpenGL instead. On mobile devices the same will undoubtedly use OpenGL ES (although I'm not sure if mobile browsers support WebGL).

  • \$\begingroup\$ Some mobile browsers can use WebGL. Most modern smart phones for sure. Writing this from a GalaxyS3 that does. \$\endgroup\$ – Vaughan Hilts Apr 14 '14 at 15:48

Java defaults to using GDI (AWT, Swing). JavaFX supposedly will be able to make use of OpenGL in future. Java + LWJGL (an OpenGL wrapper that accesses native opengl32.dll via JNI) provides more direct hardware-accelerated support for Java.

Flash Player 11 onward made use of OpenGL via Stage3D. Without using Stage3D, it is using a software renderer built to work within the browser. All browser output gets routed through the selected desktop renderer, which may be either GDI / software or hardware accelerated, dependent on user display settings.

Unity uses OpenGL as well, since you are asking about "all languages". Python uses GDI unless PyOpenGL, DirectPython or similar is explicitly used instead. Native instructions via e.g. C or Assembly again use either GDI or access OpenGL / DirectX directly. Back in the days of Glide, it was a similar story; a DLL provided API access to the underlying graphics hardware.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.