aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-03-02 21:42:17 +0000
committerChien Yang <[email protected]>2007-03-02 21:42:17 +0000
commitf558afb8ef2797ff0cfe3e9918ffcee29892d6d1 (patch)
tree33d66c0f6396adf87199983a62d3f75b6ac84805 /src
parent457dd697715116c02162b78e539d1355353c0eaf (diff)
Completed the fix to Issue 415 - Need ability to disable NPOT textures for raster/background
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@783 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src')
-rw-r--r--src/native/d3d/D3dCtx.cpp80
1 files changed, 44 insertions, 36 deletions
diff --git a/src/native/d3d/D3dCtx.cpp b/src/native/d3d/D3dCtx.cpp
index 8338d7e..6ce5d34 100644
--- a/src/native/d3d/D3dCtx.cpp
+++ b/src/native/d3d/D3dCtx.cpp
@@ -1413,8 +1413,19 @@ VOID D3dCtx::setCanvasProperty(JNIEnv *env, jobject obj)
//id = env->GetFieldID(canvasCls, "userStencilAvailable", "Z");
//env->SetBooleanField(obj, id, deviceInfo->supportStencil );
+
id = env->GetFieldID(canvasCls, "textureExtendedFeatures", "I");
- env->SetIntField(obj, id, deviceInfo->getTextureFeaturesMask());
+ int texMask = deviceInfo->getTextureFeaturesMask();
+ jboolean enforcePowerOfTwo = getJavaBoolEnv(env, "enforcePowerOfTwo");
+ if(enforcePowerOfTwo) {
+ // printf("DEBUG enforcePowerOfTwo is true");
+ // Reset NPOT support as requested by user.
+ deviceInfo->supportNPOT = false;
+ texMask &= ~javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO;
+ }
+ env->SetIntField(obj, id, texMask);
+
+
id = env->GetFieldID(canvasCls, "extensionsSupported", "I");
env->SetIntField(obj, id, mask);
@@ -2037,47 +2048,44 @@ BOOL D3dCtx::createFrontBuffer()
jboolean D3dCtx::getJavaBoolEnv(JNIEnv *env, char* envStr)
{
- jclass systemClass = env->FindClass( "javax/media/j3d/MasterControl" );
- if ( systemClass != NULL )
- {
- jmethodID method = env->GetStaticMethodID(
- systemClass, "getProperty",
- "(Ljava/lang/String;)Ljava/lang/String;" );
- if ( method != NULL )
- {
- jstring name = env->NewStringUTF( envStr );
- jstring property = reinterpret_cast<jstring>(
- env->CallStaticObjectMethod(
- systemClass, method, name ));
- if ( property != NULL )
- {
- jboolean isCopy;
- const char * chars = env->GetStringUTFChars(
- property, &isCopy );
- if ( chars != 0 )
- {
- if ( stricmp( chars, "true" ) == 0 )
- {
- env->ReleaseStringUTFChars( property, chars );
- return true;
- }
- else
- {
- env->ReleaseStringUTFChars( property, chars );
- return false;
- }
- env->ReleaseStringUTFChars( property, chars );
- }
- }
- }
+ jclass cls;
+ jfieldID fieldID;
+ jobject obj;
+
+ cls = env->FindClass( "javax/media/j3d/VirtualUniverse" );
+
+ if (cls == NULL) {
+ return JNI_FALSE;
}
- return false;
-}
+ fieldID = (jfieldID) env->GetStaticFieldID( cls, "mc",
+ "Ljavax/media/j3d/MasterControl;");
+ if (fieldID == NULL) {
+ return JNI_FALSE;
+ }
+
+ obj = env->GetStaticObjectField( cls, fieldID);
+
+ if (obj == NULL) {
+ return JNI_FALSE;
+ }
+
+ cls = (jclass) env->FindClass("javax/media/j3d/MasterControl");
+
+ if (cls == NULL) {
+ return JNI_FALSE;
+ }
+ fieldID = (jfieldID) env->GetFieldID( cls, envStr, "Z");
+ if (fieldID == NULL ) {
+ return JNI_FALSE;
+ }
+ return env->GetBooleanField( obj, fieldID);
+
+}
/**
// this routine is not safe using current D3D routines