/** * Attempts to initialize GLX and the core OpenGL library. For this method * to return JNI_TRUE, the following must be true: * - libGL must be loaded successfully (via dlopen) * - all function symbols from libGL must be available and loaded properly * - the GLX extension must be available through X11 * - client GLX version must be >= 1.3 * If any of these requirements are not met, this method will return * JNI_FALSE, indicating there is no hope of using GLX/OpenGL for any * GraphicsConfig in the environment. */ static jboolean GLXGC_InitGLX() { int errorbase, eventbase; const char *version; J2dRlsTraceLn(J2D_TRACE_INFO, "GLXGC_InitGLX"); if (!OGLFuncs_OpenLibrary()) { return JNI_FALSE; } if (!OGLFuncs_InitPlatformFuncs() || !OGLFuncs_InitBaseFuncs() || !OGLFuncs_InitExtFuncs()) { OGLFuncs_CloseLibrary(); return JNI_FALSE; } if (!j2d_glXQueryExtension(awt_display, &errorbase, &eventbase)) { J2dRlsTraceLn(J2D_TRACE_ERROR, "GLXGC_InitGLX: GLX extension is not present"); OGLFuncs_CloseLibrary(); return JNI_FALSE; } version = j2d_glXGetClientString(awt_display, GLX_VERSION); if (version == NULL) { J2dRlsTraceLn(J2D_TRACE_ERROR, "GLXGC_InitGLX: could not query GLX version"); OGLFuncs_CloseLibrary(); return JNI_FALSE; } // we now only verify that the client GLX version is >= 1.3 (if the // server does not support GLX 1.3, then we will find that out later // when we attempt to create a GLXFBConfig) J2dRlsTraceLn1(J2D_TRACE_INFO, "GLXGC_InitGLX: client GLX version=%s", version); if (!((version[0] == '1' && version[2] >= '3') || (version[0] > '1'))) { J2dRlsTraceLn(J2D_TRACE_ERROR, "GLXGC_InitGLX: invalid GLX version; 1.3 is required"); OGLFuncs_CloseLibrary(); return JNI_FALSE; } return JNI_TRUE; }
/** * Attempts to initialize WGL and the core OpenGL library. For this method * to return JNI_TRUE, the following must be true: * - opengl32.dll must be loaded successfully (via LoadLibrary) * - all core WGL/OGL function symbols from opengl32.dll must be * available and loaded properly * If any of these requirements are not met, this method will return * JNI_FALSE, indicating there is no hope of using WGL/OpenGL for any * GraphicsConfig in the environment. */ JNIEXPORT jboolean JNICALL Java_sun_java2d_opengl_WGLGraphicsConfig_initWGL(JNIEnv *env, jclass wglgc) { J2dRlsTraceLn(J2D_TRACE_INFO, "WGLGraphicsConfig_initWGL"); if (!OGLFuncs_OpenLibrary()) { return JNI_FALSE; } if (!OGLFuncs_InitPlatformFuncs() || !OGLFuncs_InitBaseFuncs()) { OGLFuncs_CloseLibrary(); return JNI_FALSE; } return JNI_TRUE; }
/** * Attempts to initialize WGL and the core OpenGL library. For this method * to return JNI_TRUE, the following must be true: * - opengl32.dll must be loaded successfully (via LoadLibrary) * - all core WGL/OGL function symbols from opengl32.dll must be * available and loaded properly * If any of these requirements are not met, this method will return * JNI_FALSE, indicating there is no hope of using WGL/OpenGL for any * GraphicsConfig in the environment. */ static jboolean WGLGC_InitWGL() { J2dTraceLn(J2D_TRACE_INFO, "in WGLGC_InitWGL"); if (!OGLFuncs_OpenLibrary()) { return JNI_FALSE; } if (!OGLFuncs_InitPlatformFuncs() || !OGLFuncs_InitBaseFuncs()) { OGLFuncs_CloseLibrary(); return JNI_FALSE; } return JNI_TRUE; }