64 |
setWindow(window); |
setWindow(window); |
65 |
DBG(dbg_render) << "2\n"; |
DBG(dbg_render) << "2\n"; |
66 |
|
|
|
if(sizeof(jint) != sizeof(jint) || |
|
|
sizeof(jfloat) != sizeof(float)) |
|
|
env->FatalError("Invalid data type sizes!"); |
|
|
DBG(dbg_render) << "3\n"; |
|
|
|
|
67 |
jint *inds1 = env->GetIntArrayElements(j_inds1, 0); |
jint *inds1 = env->GetIntArrayElements(j_inds1, 0); |
68 |
DBG(dbg_render) << "4\n"; |
DBG(dbg_render) << "4\n"; |
69 |
jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0); |
jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0); |
126 |
} |
} |
127 |
|
|
128 |
Renderer::fpsTick(); |
Renderer::fpsTick(); |
129 |
} |
} |
130 |
|
|
131 |
|
#include <sys/time.h> |
132 |
|
static double getTime() { |
133 |
|
struct timeval t; |
134 |
|
gettimeofday(&t, 0); |
135 |
|
return t.tv_usec*1E-6 + t.tv_sec; |
136 |
|
} |
137 |
|
|
138 |
|
jf( jdouble, timeRenderImpl) |
139 |
|
(JNIEnv *env, jclass, |
140 |
|
jint window, jint iters, |
141 |
|
jint ninds, jintArray j_inds1, jfloatArray j_pts1, jintArray j_codes, |
142 |
|
jboolean standardcoords, jboolean swapbuf) { |
143 |
|
|
144 |
|
DBG(dbg_render) << "RENDER "<<window<<" "<<" " |
145 |
|
<<j_inds1<<" "<<j_pts1<<" "<< |
146 |
|
" "<<j_codes<<"\n"; |
147 |
|
GLERR |
148 |
|
DBG(dbg_render) << "1\n"; |
149 |
|
if(standardcoords) |
150 |
|
setWindow(window); |
151 |
|
DBG(dbg_render) << "2\n"; |
152 |
|
|
153 |
|
jint *inds1 = env->GetIntArrayElements(j_inds1, 0); |
154 |
|
DBG(dbg_render) << "4\n"; |
155 |
|
jfloat *pts1 = env->GetFloatArrayElements(j_pts1, 0); |
156 |
|
DBG(dbg_render) << "5\n"; |
157 |
|
|
158 |
|
jint *inds2 = 0; |
159 |
|
jfloat *pts2 = 0; |
160 |
|
jint *interpinds = 0; |
161 |
|
|
162 |
|
jint *codes = env->GetIntArrayElements(j_codes, 0); |
163 |
|
|
164 |
|
DBG(dbg_render) << "Got data\n"; |
165 |
|
|
166 |
|
renderer.setPoints((int)ninds, |
167 |
|
(int *)inds1, (float *)pts1, |
168 |
|
(int *)interpinds, |
169 |
|
(int *)inds2, (float *)pts2, |
170 |
|
0, 1); |
171 |
|
|
172 |
|
DBG(dbg_render) << "Set datapoints\n"; |
173 |
|
|
174 |
|
if(standardcoords) { |
175 |
|
int xywh[4]; |
176 |
|
windows.get(window)->getSize(xywh); |
177 |
|
DBG(dbg_render) << "Did getSize "<<xywh[0]<<" "<<xywh[1]<<" "<<xywh[2]<<" " |
178 |
|
<<xywh[3]<<"\n"; |
179 |
|
|
180 |
|
Renderer::setStandardCoordinates(Vec(xywh[2], xywh[3])); |
181 |
|
} |
182 |
|
GLERR |
183 |
|
|
184 |
|
double t0 = getTime(); |
185 |
|
for(int iter = 0; iter < iters; iter++) { |
186 |
|
DBG(dbg_render) << "Did stdcoords\n"; |
187 |
|
renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s); |
188 |
|
DBG(dbg_render) << "Did renderscene\n"; |
189 |
|
if(swapbuf) { |
190 |
|
windows.get(window)->swapBuffers(); |
191 |
|
DBG(dbg_render) << "Did swapbuffers\n"; |
192 |
|
} |
193 |
|
} |
194 |
|
double t1 = getTime(); |
195 |
|
double t = t1 - t0; |
196 |
|
DBG(dbg) << "The time was " << t << " [" << t0 << " - " << t1 << "]\n"; |
197 |
|
|
198 |
|
env->ReleaseIntArrayElements(j_codes, codes, JNI_ABORT); |
199 |
|
|
200 |
|
env->ReleaseIntArrayElements(j_inds1, inds1, JNI_ABORT); |
201 |
|
env->ReleaseFloatArrayElements(j_pts1, pts1, JNI_ABORT); |
202 |
|
|
203 |
|
DBG(dbg_render) << "Did releasearrays\n"; |
204 |
|
GLERR |
205 |
|
|
206 |
|
if(standardcoords) { |
207 |
|
releaseWindow(); |
208 |
|
} |
209 |
|
|
210 |
|
return t; |
211 |
|
} |
212 |
|
|
213 |
|
|
214 |
} |
} |