aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/ogl
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2006-10-19 23:41:27 +0000
committerChien Yang <[email protected]>2006-10-19 23:41:27 +0000
commitdf863b1f8aa929ab70e6cb7d8f7861eb55af4bad (patch)
treed6f7c343a3f2a19c290b3a07873e2e88948d23eb /src/native/ogl
parent9414e967cfe4f287e15ded496d00d304ee24ca53 (diff)
1) Ported readRaster, executeRasterDepth, readOffScreenBuffer, and partially done on textureFillBackground.
2) Removed unuse code in ogl and d3d. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@722 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/ogl')
-rw-r--r--src/native/ogl/GraphicsContext3D.c154
1 files changed, 0 insertions, 154 deletions
diff --git a/src/native/ogl/GraphicsContext3D.c b/src/native/ogl/GraphicsContext3D.c
index 50f73bf..b785277 100644
--- a/src/native/ogl/GraphicsContext3D.c
+++ b/src/native/ogl/GraphicsContext3D.c
@@ -160,157 +160,3 @@ void JNICALL Java_javax_media_j3d_NativePipeline_readRaster(
}
-
-JNIEXPORT
-void JNICALL Java_javax_media_j3d_NativePipeline_readRasterNative(
- JNIEnv *env, jobject obj, jlong ctx,
- jint type, jint xOffset, jint yOffset,
- jint wRaster, jint hRaster, jint hCanvas,
- jint format, jobject image, jobject depth, jobject gc)
-{
- JNIEnv table;
- int yAdjusted;
- jclass gc_class;
- GLenum gltype;
-
- GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctx;
-
- table = *env;
-
- glPixelStorei(GL_PACK_ROW_LENGTH, wRaster);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- yAdjusted = hCanvas - hRaster - yOffset;
-
- gc_class = (jclass) (*(table->GetObjectClass))(env, gc);
-
- if ((type & javax_media_j3d_Raster_RASTER_COLOR) != 0) {
-
- jclass image_class;
-
- jfieldID byteData_field;
- jarray byteData_array;
- jbyte *byteData;
-
- byteData_field = (jfieldID)(*(table->GetFieldID))(env,
- gc_class, "byteBuffer","[B");
- byteData_array = (jarray)(*(table->GetObjectField))(env, gc,
- byteData_field);
-
- image_class = (jclass) (*(table->GetObjectClass))(env, image);
-
- if (image_class == NULL) {
- return;
- }
-
- switch (format) {
- case IMAGE_FORMAT_BYTE_RGBA:
- gltype = GL_RGBA;
- break;
- case IMAGE_FORMAT_BYTE_RGB:
- gltype = GL_RGB;
- break;
-
- case IMAGE_FORMAT_BYTE_ABGR:
- if (ctxProperties->abgr_ext) { /* If its zero, should never come here! */
- gltype = GL_ABGR_EXT;
- }
- break;
-
- case IMAGE_FORMAT_BYTE_BGR:
- gltype = GL_BGR;
- break;
- case IMAGE_FORMAT_BYTE_LA:
- gltype = GL_LUMINANCE_ALPHA;
- break;
-
- case IMAGE_FORMAT_BYTE_GRAY:
- case IMAGE_FORMAT_USHORT_GRAY:
- default:
- throwAssert(env, "illegal format");
- break;
- }
- byteData = (jbyte *)(*(table->GetPrimitiveArrayCritical))(env,
- byteData_array, NULL);
- glReadPixels(xOffset, yAdjusted, wRaster, hRaster,
- gltype, GL_UNSIGNED_BYTE, byteData);
-
- /*
- {
- int i, j , *intData;
- fprintf(stderr, "format = %d, wRaster = %d, hRaster = %d\n\n", format, wRaster, hRaster);
- intData = (int*)byteData;
- for (i = 0; i < wRaster; i++) {
- for (j = 0; j < hRaster; j++, intData++) {
- fprintf(stderr, " 0x%x", *intData);
- }
- fprintf(stderr, "\n");
- }
- }
- */
- (*(table->ReleasePrimitiveArrayCritical))(env, byteData_array,
- byteData, 0);
- }
-
-
- if ((type & javax_media_j3d_Raster_RASTER_DEPTH) != 0) {
-
- jclass depth_class;
- jfieldID wDepth_field, depth_type_field;
- jint depth_type, wDepth;
-
- depth_class = (jclass) (*(table->GetObjectClass))(env, depth);
-
- if (depth_class == NULL) {
- return;
- }
-
- wDepth_field = (jfieldID) (*(table->GetFieldID))(env, depth_class,
- "width", "I");
- wDepth = (jint)(*(table->GetIntField))(env, depth, wDepth_field);
-
- depth_type_field = (jfieldID) (*(table->GetFieldID))(env,
- depth_class, "type", "I");
- depth_type = (jint)(*(table->GetIntField))(env, depth,
- depth_type_field);
-
- if (depth_type == javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_INT) {
- jfieldID intData_field;
- jarray intData_array;
- jint *intData;
-
- intData_field = (jfieldID)(*(table->GetFieldID))(env,
- gc_class, "intBuffer","[I");
- intData_array = (jarray)(*(table->GetObjectField))(env, gc,
- intData_field);
-
- intData = (jint *)(*(table->GetPrimitiveArrayCritical))(env,
- intData_array, NULL);
-
- /* yOffset is adjusted for OpenGL - Y upward */
- glReadPixels(xOffset, yAdjusted, wRaster, hRaster,
- GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, intData);
-
- (*(table->ReleasePrimitiveArrayCritical))(env, intData_array,
- intData, 0);
- } else { /* javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_FLOAT */
- jfieldID floatData_field;
- jarray floatData_array;
- jfloat *floatData;
-
- floatData_field = (jfieldID)(*(table->GetFieldID))(env,
- gc_class, "floatBuffer","[F");
- floatData_array = (jarray)(*(table->GetObjectField))(env, gc,
- floatData_field);
- floatData = (jfloat *)(*(table->GetPrimitiveArrayCritical))(env,
- floatData_array, NULL);
-
- /* yOffset is adjusted for OpenGL - Y upward */
- glReadPixels(xOffset, yAdjusted, wRaster, hRaster,
- GL_DEPTH_COMPONENT, GL_FLOAT, floatData);
-
- (*(table->ReleasePrimitiveArrayCritical))(env, floatData_array,
- floatData, 0);
- }
- }
-}
-