diff options
author | Kevin Rushforth <[email protected]> | 2004-06-09 04:25:41 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2004-06-09 04:25:41 +0000 |
commit | 343b658c32a6473c545187c1e276ee5d06c2686a (patch) | |
tree | ad2606538b7db1c3553c53a79ccccb2ed5b5e4e2 /src/native/ogl/CompressedGeometryRetained.c | |
parent | 06cebb1e576da6f7222f999ab059dcfa3d8edd39 (diff) |
Initial creation of j3d-core-utils sources in CVS repository
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@7 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/ogl/CompressedGeometryRetained.c')
-rw-r--r-- | src/native/ogl/CompressedGeometryRetained.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/native/ogl/CompressedGeometryRetained.c b/src/native/ogl/CompressedGeometryRetained.c new file mode 100644 index 0000000..36ca164 --- /dev/null +++ b/src/native/ogl/CompressedGeometryRetained.c @@ -0,0 +1,70 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. + * + * Use is subject to license terms. + * + * $Revision$ + * $Date$ + * $State$ + */ + +#include <stdio.h> +#include <jni.h> +#include "gldefs.h" + +#ifdef SOLARIS +#pragma weak glDrawCompressedGeomSUNX + +#else +static void glDrawCompressedGeomSUNX(GLint size, GLubyte *data) { + fprintf(stderr, "Warning: glDrawCompressedGeomSUNX() not supported\n") ; +} +#endif /* SOLARIS */ + + +JNIEXPORT +void JNICALL Java_javax_media_j3d_CompressedGeometryRetained_execute + (JNIEnv *env, jobject obj, jlong ctxInfo, jint version, jint bufferType, + jint bufferContents, jint renderFlags, jint offset, jint size, + jbyteArray geometry) +{ + GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; + jlong ctx = ctxProperties->context; + + jbyte *cg = (*env)->GetPrimitiveArrayCritical(env, geometry, 0) ; + + /* ignore offset and pass header at 0 along with cg data */ + if(ctxProperties->geometry_compression_sunx) + glDrawCompressedGeomSUNX((GLint)(size + 48), (GLubyte *)cg) ; + + (*env)->ReleasePrimitiveArrayCritical(env, geometry, cg, 0) ; +} + + +JNIEXPORT +jboolean JNICALL Java_javax_media_j3d_CompressedGeometryRetained_decompressByRef + (JNIEnv *env, jobject obj, jlong ctxInfo) +{ + return JNI_FALSE ; +} + +JNIEXPORT +jboolean JNICALL Java_javax_media_j3d_CompressedGeometryRetained_decompressHW + (JNIEnv *env, jobject obj, jlong ctxInfo, jint majorVersion, jint minorVersion) +{ + /* + * Return true if hardware decompression is supported for the given + * version number of the compressed geometry. + */ + + GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; + jlong ctx = ctxProperties->context; + + return + (ctxProperties->geometry_compression_accelerated == 1) && + ((majorVersion < ctxProperties->geometry_compression_accelerated_major_version) || + ((majorVersion == ctxProperties->geometry_compression_accelerated_major_version) && + (minorVersion <= ctxProperties->geometry_compression_accelerated_minor_version))) ; +} |