645 * - FBO support has been enabled via the system property 646 * - we can successfully create an FBO with depth capabilities 647 */ 648 static jboolean 649 OGLContext_IsFBObjectExtensionAvailable(JNIEnv *env, 650 const char *extString) 651 { 652 jboolean isFBObjectEnabled = JNI_FALSE; 653 GLuint fbobjectID, textureID, depthID; 654 jint width = 1, height = 1; 655 656 J2dTraceLn(J2D_TRACE_INFO, "OGLContext_IsFBObjectExtensionAvailable"); 657 658 // first see if the fbobject extension is available 659 if (!OGLContext_IsExtensionAvailable(extString, 660 "GL_EXT_framebuffer_object")) 661 { 662 return JNI_FALSE; 663 } 664 665 // next see if the fbobject system property has been enabled 666 isFBObjectEnabled = 667 JNU_GetStaticFieldByName(env, NULL, 668 "sun/java2d/opengl/OGLSurfaceData", 669 "isFBObjectEnabled", "Z").z; 670 if (!isFBObjectEnabled) { 671 J2dRlsTraceLn(J2D_TRACE_INFO, 672 "OGLContext_IsFBObjectExtensionAvailable: disabled via flag"); 673 return JNI_FALSE; 674 } 675 676 // finally, create a dummy fbobject with depth capabilities to see 677 // if this configuration is supported by the drivers/hardware 678 // (first we initialize a color texture object that will be used to 679 // construct the dummy fbobject) 680 j2d_glGenTextures(1, &textureID); 681 j2d_glBindTexture(GL_TEXTURE_2D, textureID); 682 j2d_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 683 width, height, 0, 684 GL_RGB, GL_UNSIGNED_BYTE, NULL); | 645 * - FBO support has been enabled via the system property 646 * - we can successfully create an FBO with depth capabilities 647 */ 648 static jboolean 649 OGLContext_IsFBObjectExtensionAvailable(JNIEnv *env, 650 const char *extString) 651 { 652 jboolean isFBObjectEnabled = JNI_FALSE; 653 GLuint fbobjectID, textureID, depthID; 654 jint width = 1, height = 1; 655 656 J2dTraceLn(J2D_TRACE_INFO, "OGLContext_IsFBObjectExtensionAvailable"); 657 658 // first see if the fbobject extension is available 659 if (!OGLContext_IsExtensionAvailable(extString, 660 "GL_EXT_framebuffer_object")) 661 { 662 return JNI_FALSE; 663 } 664 665 // next see if the depth texture extension is available 666 if (!OGLContext_IsExtensionAvailable(extString, 667 "GL_ARB_depth_texture")) 668 { 669 return JNI_FALSE; 670 } 671 672 // next see if the fbobject system property has been enabled 673 isFBObjectEnabled = 674 JNU_GetStaticFieldByName(env, NULL, 675 "sun/java2d/opengl/OGLSurfaceData", 676 "isFBObjectEnabled", "Z").z; 677 if (!isFBObjectEnabled) { 678 J2dRlsTraceLn(J2D_TRACE_INFO, 679 "OGLContext_IsFBObjectExtensionAvailable: disabled via flag"); 680 return JNI_FALSE; 681 } 682 683 // finally, create a dummy fbobject with depth capabilities to see 684 // if this configuration is supported by the drivers/hardware 685 // (first we initialize a color texture object that will be used to 686 // construct the dummy fbobject) 687 j2d_glGenTextures(1, &textureID); 688 j2d_glBindTexture(GL_TEXTURE_2D, textureID); 689 j2d_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 690 width, height, 0, 691 GL_RGB, GL_UNSIGNED_BYTE, NULL); |