37 |
using namespace Vob; |
using namespace Vob; |
38 |
using namespace Vob::JNI; |
using namespace Vob::JNI; |
39 |
using std::cout; |
using std::cout; |
40 |
STATICDBGVAR(dbg, "JNI.render"); |
STATICDBGVAR(dbg_render, "JNI.render"); |
41 |
|
|
42 |
namespace Vob { |
namespace Vob { |
43 |
|
|
55 |
jintArray j_inds2, jfloatArray j_pts2, |
jintArray j_inds2, jfloatArray j_pts2, |
56 |
jintArray j_codes, |
jintArray j_codes, |
57 |
jfloat fract, jboolean standardcoords, jboolean showFinal) { |
jfloat fract, jboolean standardcoords, jboolean showFinal) { |
58 |
DBG(dbg) << "RENDER "<<window<<" "<<numinds<<" " |
DBG(dbg_render) << "RENDER "<<window<<" "<<numinds<<" " |
59 |
<<j_inds1<<" "<<j_pts1<<" "<< |
<<j_inds1<<" "<<j_pts1<<" "<< |
60 |
j_interpinds<<" "<<j_inds2<<" "<<j_pts2<<" "<<j_codes<<"\n"; |
j_interpinds<<" "<<j_inds2<<" "<<j_pts2<<" "<<j_codes<<"\n"; |
61 |
GLERR |
GLERR |
62 |
DBG(dbg) << "1\n"; |
DBG(dbg_render) << "1\n"; |
63 |
if(standardcoords) |
if(standardcoords) |
64 |
setWindow(window); |
setWindow(window); |
65 |
DBG(dbg) << "2\n"; |
DBG(dbg_render) << "2\n"; |
66 |
|
|
67 |
if(sizeof(jint) != sizeof(jint) || |
if(sizeof(jint) != sizeof(jint) || |
68 |
sizeof(jfloat) != sizeof(float)) |
sizeof(jfloat) != sizeof(float)) |
69 |
env->FatalError("Invalid data type sizes!"); |
env->FatalError("Invalid data type sizes!"); |
70 |
DBG(dbg) << "3\n"; |
DBG(dbg_render) << "3\n"; |
71 |
|
|
72 |
jint *inds1 = env->GetIntArrayElements(j_inds1, 0); |
jint *inds1 = env->GetIntArrayElements(j_inds1, 0); |
73 |
DBG(dbg) << "4\n"; |
DBG(dbg_render) << "4\n"; |
74 |
jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0); |
jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0); |
75 |
DBG(dbg) << "5\n"; |
DBG(dbg_render) << "5\n"; |
76 |
|
|
77 |
jint *inds2 = 0; |
jint *inds2 = 0; |
78 |
jfloat *pts2 = 0; |
jfloat *pts2 = 0; |
79 |
jint *interpinds = 0; |
jint *interpinds = 0; |
80 |
if(j_inds2 != 0) { |
if(j_inds2 != 0) { |
81 |
DBG(dbg) << "6\n"; |
DBG(dbg_render) << "6\n"; |
82 |
inds2 = env->GetIntArrayElements(j_inds2, 0); |
inds2 = env->GetIntArrayElements(j_inds2, 0); |
83 |
pts2 = env->GetFloatArrayElements(j_pts2, 0); |
pts2 = env->GetFloatArrayElements(j_pts2, 0); |
84 |
interpinds = env->GetIntArrayElements(j_interpinds, 0); |
interpinds = env->GetIntArrayElements(j_interpinds, 0); |
85 |
} |
} |
86 |
DBG(dbg) << "7\n"; |
DBG(dbg_render) << "7\n"; |
87 |
|
|
88 |
jint *codes = env->GetIntArrayElements(j_codes, 0); |
jint *codes = env->GetIntArrayElements(j_codes, 0); |
89 |
|
|
90 |
DBG(dbg) << "Got data\n"; |
DBG(dbg_render) << "Got data\n"; |
91 |
|
|
92 |
renderer.setPoints((int)numinds, |
renderer.setPoints((int)numinds, |
93 |
(int *)inds1, (float *)pts1, |
(int *)inds1, (float *)pts1, |
95 |
(int *)inds2, (float *)pts2, |
(int *)inds2, (float *)pts2, |
96 |
(float)fract, (bool)showFinal); |
(float)fract, (bool)showFinal); |
97 |
|
|
98 |
DBG(dbg) << "Set datapoints\n"; |
DBG(dbg_render) << "Set datapoints\n"; |
99 |
|
|
100 |
if(standardcoords) { |
if(standardcoords) { |
101 |
int xywh[4]; |
int xywh[4]; |
102 |
windows.get(window)->getSize(xywh); |
windows.get(window)->getSize(xywh); |
103 |
DBG(dbg) << "Did getSize "<<xywh[0]<<" "<<xywh[1]<<" "<<xywh[2]<<" " |
DBG(dbg_render) << "Did getSize "<<xywh[0]<<" "<<xywh[1]<<" "<<xywh[2]<<" " |
104 |
<<xywh[3]<<"\n"; |
<<xywh[3]<<"\n"; |
105 |
|
|
106 |
Renderer::setStandardCoordinates(Vec(xywh[2], xywh[3])); |
Renderer::setStandardCoordinates(Vec(xywh[2], xywh[3])); |
107 |
} |
} |
108 |
GLERR |
GLERR |
109 |
|
|
110 |
DBG(dbg) << "Did stdcoords\n"; |
DBG(dbg_render) << "Did stdcoords\n"; |
111 |
renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s); |
renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s); |
112 |
DBG(dbg) << "Did renderscene\n"; |
DBG(dbg_render) << "Did renderscene\n"; |
113 |
windows.get(window)->swapBuffers(); |
windows.get(window)->swapBuffers(); |
114 |
DBG(dbg) << "Did swapbuffers\n"; |
DBG(dbg_render) << "Did swapbuffers\n"; |
115 |
|
|
116 |
env->ReleaseIntArrayElements(j_codes, codes, JNI_ABORT); |
env->ReleaseIntArrayElements(j_codes, codes, JNI_ABORT); |
117 |
|
|
123 |
env->ReleaseFloatArrayElements(j_pts2, pts2, JNI_ABORT); |
env->ReleaseFloatArrayElements(j_pts2, pts2, JNI_ABORT); |
124 |
env->ReleaseIntArrayElements(j_interpinds, interpinds, JNI_ABORT); |
env->ReleaseIntArrayElements(j_interpinds, interpinds, JNI_ABORT); |
125 |
} |
} |
126 |
DBG(dbg) << "Did releasearrays\n"; |
DBG(dbg_render) << "Did releasearrays\n"; |
127 |
GLERR |
GLERR |
128 |
|
|
129 |
if(standardcoords) { |
if(standardcoords) { |