2
|
1 |
/*
|
887
|
2 |
* Copyright 2003-2008 Sun Microsystems Microsystems, Inc. All Rights Reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Sun designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Sun in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
* have any questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
#include <jlong.h>
|
|
27 |
|
|
28 |
#include "sun_java2d_opengl_GLXSurfaceData.h"
|
|
29 |
|
|
30 |
#include "OGLRenderQueue.h"
|
|
31 |
#include "GLXGraphicsConfig.h"
|
|
32 |
#include "GLXSurfaceData.h"
|
|
33 |
#include "awt_Component.h"
|
|
34 |
#include "awt_GraphicsEnv.h"
|
|
35 |
|
|
36 |
/**
|
|
37 |
* The methods in this file implement the native windowing system specific
|
|
38 |
* layer (GLX) for the OpenGL-based Java 2D pipeline.
|
|
39 |
*/
|
|
40 |
|
|
41 |
#ifndef HEADLESS
|
|
42 |
|
|
43 |
extern LockFunc OGLSD_Lock;
|
|
44 |
extern GetRasInfoFunc OGLSD_GetRasInfo;
|
|
45 |
extern UnlockFunc OGLSD_Unlock;
|
|
46 |
extern DisposeFunc OGLSD_Dispose;
|
|
47 |
|
|
48 |
extern struct MComponentPeerIDs mComponentPeerIDs;
|
|
49 |
|
887
|
50 |
extern void
|
|
51 |
OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h);
|
|
52 |
|
2
|
53 |
jboolean surfaceCreationFailed = JNI_FALSE;
|
|
54 |
|
|
55 |
#endif /* !HEADLESS */
|
|
56 |
|
|
57 |
JNIEXPORT void JNICALL
|
|
58 |
Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd,
|
|
59 |
jobject peer, jlong aData)
|
|
60 |
{
|
|
61 |
#ifndef HEADLESS
|
|
62 |
OGLSDOps *oglsdo = (OGLSDOps *)SurfaceData_InitOps(env, glxsd,
|
|
63 |
sizeof(OGLSDOps));
|
|
64 |
GLXSDOps *glxsdo = (GLXSDOps *)malloc(sizeof(GLXSDOps));
|
|
65 |
|
|
66 |
J2dTraceLn(J2D_TRACE_INFO, "GLXSurfaceData_initOps");
|
|
67 |
|
|
68 |
if (glxsdo == NULL) {
|
|
69 |
JNU_ThrowOutOfMemoryError(env, "creating native GLX ops");
|
|
70 |
return;
|
|
71 |
}
|
|
72 |
|
|
73 |
oglsdo->privOps = glxsdo;
|
|
74 |
|
|
75 |
oglsdo->sdOps.Lock = OGLSD_Lock;
|
|
76 |
oglsdo->sdOps.GetRasInfo = OGLSD_GetRasInfo;
|
|
77 |
oglsdo->sdOps.Unlock = OGLSD_Unlock;
|
|
78 |
oglsdo->sdOps.Dispose = OGLSD_Dispose;
|
|
79 |
|
|
80 |
oglsdo->drawableType = OGLSD_UNDEFINED;
|
|
81 |
oglsdo->activeBuffer = GL_FRONT;
|
|
82 |
oglsdo->needsInit = JNI_TRUE;
|
|
83 |
|
|
84 |
#ifdef XAWT
|
|
85 |
if (peer != NULL) {
|
|
86 |
glxsdo->window = JNU_CallMethodByName(env, NULL, peer,
|
|
87 |
"getContentWindow", "()J").j;
|
|
88 |
} else {
|
|
89 |
glxsdo->window = 0;
|
|
90 |
}
|
|
91 |
#else
|
|
92 |
if (peer != NULL) {
|
|
93 |
struct ComponentData *cdata;
|
|
94 |
cdata = (struct ComponentData *)
|
|
95 |
JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData);
|
|
96 |
if (cdata == NULL) {
|
|
97 |
free(glxsdo);
|
|
98 |
JNU_ThrowNullPointerException(env, "Component data missing");
|
|
99 |
return;
|
|
100 |
}
|
|
101 |
if (cdata->widget == NULL) {
|
|
102 |
free(glxsdo);
|
|
103 |
JNU_ThrowInternalError(env, "Widget is NULL in initOps");
|
|
104 |
return;
|
|
105 |
}
|
|
106 |
glxsdo->widget = cdata->widget;
|
|
107 |
} else {
|
|
108 |
glxsdo->widget = NULL;
|
|
109 |
}
|
|
110 |
#endif
|
|
111 |
|
|
112 |
glxsdo->configData = (AwtGraphicsConfigDataPtr)jlong_to_ptr(aData);
|
|
113 |
if (glxsdo->configData == NULL) {
|
|
114 |
free(glxsdo);
|
|
115 |
JNU_ThrowNullPointerException(env,
|
|
116 |
"Native GraphicsConfig data block missing");
|
|
117 |
return;
|
|
118 |
}
|
|
119 |
|
|
120 |
if (glxsdo->configData->glxInfo == NULL) {
|
|
121 |
free(glxsdo);
|
|
122 |
JNU_ThrowNullPointerException(env, "GLXGraphicsConfigInfo missing");
|
|
123 |
return;
|
|
124 |
}
|
|
125 |
#endif /* HEADLESS */
|
|
126 |
}
|
|
127 |
|
|
128 |
#ifndef HEADLESS
|
|
129 |
|
|
130 |
/**
|
|
131 |
* This function disposes of any native windowing system resources associated
|
|
132 |
* with this surface. For instance, if the given OGLSDOps is of type
|
|
133 |
* OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer
|
|
134 |
* surface.
|
|
135 |
*/
|
|
136 |
void
|
|
137 |
OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo)
|
|
138 |
{
|
|
139 |
GLXSDOps *glxsdo = (GLXSDOps *)oglsdo->privOps;
|
|
140 |
|
|
141 |
J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface");
|
|
142 |
|
|
143 |
if (oglsdo->drawableType == OGLSD_PBUFFER) {
|
|
144 |
if (glxsdo->drawable != 0) {
|
|
145 |
j2d_glXDestroyPbuffer(awt_display, glxsdo->drawable);
|
|
146 |
glxsdo->drawable = 0;
|
|
147 |
}
|
|
148 |
} else if (oglsdo->drawableType == OGLSD_WINDOW) {
|
|
149 |
// X Window is free'd later by AWT code...
|
|
150 |
}
|
|
151 |
}
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Makes the given context current to its associated "scratch" surface. If
|
|
155 |
* the operation is successful, this method will return JNI_TRUE; otherwise,
|
|
156 |
* returns JNI_FALSE.
|
|
157 |
*/
|
|
158 |
static jboolean
|
|
159 |
GLXSD_MakeCurrentToScratch(JNIEnv *env, OGLContext *oglc)
|
|
160 |
{
|
|
161 |
GLXCtxInfo *ctxInfo;
|
|
162 |
|
|
163 |
J2dTraceLn(J2D_TRACE_INFO, "GLXSD_MakeCurrentToScratch");
|
|
164 |
|
|
165 |
if (oglc == NULL) {
|
|
166 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
167 |
"GLXSD_MakeCurrentToScratch: context is null");
|
|
168 |
return JNI_FALSE;
|
|
169 |
}
|
|
170 |
|
|
171 |
ctxInfo = (GLXCtxInfo *)oglc->ctxInfo;
|
|
172 |
if (!j2d_glXMakeContextCurrent(awt_display,
|
|
173 |
ctxInfo->scratchSurface,
|
|
174 |
ctxInfo->scratchSurface,
|
|
175 |
ctxInfo->context))
|
|
176 |
{
|
|
177 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
178 |
"GLXSD_MakeCurrentToScratch: could not make current");
|
|
179 |
return JNI_FALSE;
|
|
180 |
}
|
|
181 |
|
|
182 |
return JNI_TRUE;
|
|
183 |
}
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Returns a pointer (as a jlong) to the native GLXGraphicsConfigInfo
|
|
187 |
* associated with the given OGLSDOps. This method can be called from
|
|
188 |
* shared code to retrieve the native GraphicsConfig data in a platform-
|
|
189 |
* independent manner.
|
|
190 |
*/
|
|
191 |
jlong
|
|
192 |
OGLSD_GetNativeConfigInfo(OGLSDOps *oglsdo)
|
|
193 |
{
|
|
194 |
GLXSDOps *glxsdo;
|
|
195 |
|
|
196 |
if (oglsdo == NULL) {
|
|
197 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
198 |
"OGLSD_GetNativeConfigInfo: ops are null");
|
|
199 |
return 0L;
|
|
200 |
}
|
|
201 |
|
|
202 |
glxsdo = (GLXSDOps *)oglsdo->privOps;
|
|
203 |
if (glxsdo == NULL) {
|
|
204 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
205 |
"OGLSD_GetNativeConfigInfo: glx ops are null");
|
|
206 |
return 0L;
|
|
207 |
}
|
|
208 |
|
|
209 |
if (glxsdo->configData == NULL) {
|
|
210 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
211 |
"OGLSD_GetNativeConfigInfo: config data is null");
|
|
212 |
return 0L;
|
|
213 |
}
|
|
214 |
|
|
215 |
return ptr_to_jlong(glxsdo->configData->glxInfo);
|
|
216 |
}
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Makes the given GraphicsConfig's context current to its associated
|
|
220 |
* "scratch" surface. If there is a problem making the context current,
|
|
221 |
* this method will return NULL; otherwise, returns a pointer to the
|
|
222 |
* OGLContext that is associated with the given GraphicsConfig.
|
|
223 |
*/
|
|
224 |
OGLContext *
|
|
225 |
OGLSD_SetScratchSurface(JNIEnv *env, jlong pConfigInfo)
|
|
226 |
{
|
|
227 |
GLXGraphicsConfigInfo *glxInfo =
|
|
228 |
(GLXGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo);
|
|
229 |
OGLContext *oglc;
|
|
230 |
|
|
231 |
J2dTraceLn(J2D_TRACE_INFO, "OGLSD_SetScratchContext");
|
|
232 |
|
|
233 |
if (glxInfo == NULL) {
|
|
234 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
235 |
"OGLSD_SetScratchContext: glx config info is null");
|
|
236 |
return NULL;
|
|
237 |
}
|
|
238 |
|
|
239 |
oglc = glxInfo->context;
|
|
240 |
if (!GLXSD_MakeCurrentToScratch(env, oglc)) {
|
|
241 |
return NULL;
|
|
242 |
}
|
|
243 |
|
|
244 |
if (OGLC_IS_CAP_PRESENT(oglc, CAPS_EXT_FBOBJECT)) {
|
|
245 |
// the GL_EXT_framebuffer_object extension is present, so this call
|
|
246 |
// will ensure that we are bound to the scratch pbuffer (and not
|
|
247 |
// some other framebuffer object)
|
|
248 |
j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
|
249 |
}
|
|
250 |
|
|
251 |
return oglc;
|
|
252 |
}
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Makes a context current to the given source and destination
|
|
256 |
* surfaces. If there is a problem making the context current, this method
|
|
257 |
* will return NULL; otherwise, returns a pointer to the OGLContext that is
|
|
258 |
* associated with the destination surface.
|
|
259 |
*/
|
|
260 |
OGLContext *
|
|
261 |
OGLSD_MakeOGLContextCurrent(JNIEnv *env, OGLSDOps *srcOps, OGLSDOps *dstOps)
|
|
262 |
{
|
|
263 |
GLXSDOps *dstGLXOps = (GLXSDOps *)dstOps->privOps;
|
|
264 |
OGLContext *oglc;
|
|
265 |
|
|
266 |
J2dTraceLn(J2D_TRACE_INFO, "OGLSD_MakeOGLContextCurrent");
|
|
267 |
|
|
268 |
oglc = dstGLXOps->configData->glxInfo->context;
|
|
269 |
if (oglc == NULL) {
|
|
270 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
271 |
"OGLSD_MakeOGLContextCurrent: context is null");
|
|
272 |
return NULL;
|
|
273 |
}
|
|
274 |
|
|
275 |
if (dstOps->drawableType == OGLSD_FBOBJECT) {
|
|
276 |
OGLContext *currentContext = OGLRenderQueue_GetCurrentContext();
|
|
277 |
|
|
278 |
// first make sure we have a current context (if the context isn't
|
|
279 |
// already current to some drawable, we will make it current to
|
|
280 |
// its scratch surface)
|
|
281 |
if (oglc != currentContext) {
|
|
282 |
if (!GLXSD_MakeCurrentToScratch(env, oglc)) {
|
|
283 |
return NULL;
|
|
284 |
}
|
|
285 |
}
|
|
286 |
|
|
287 |
// now bind to the fbobject associated with the destination surface;
|
|
288 |
// this means that all rendering will go into the fbobject destination
|
|
289 |
// (note that we unbind the currently bound texture first; this is
|
|
290 |
// recommended procedure when binding an fbobject)
|
|
291 |
j2d_glBindTexture(dstOps->textureTarget, 0);
|
|
292 |
j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, dstOps->fbobjectID);
|
|
293 |
} else {
|
|
294 |
GLXSDOps *srcGLXOps = (GLXSDOps *)srcOps->privOps;
|
|
295 |
GLXCtxInfo *ctxinfo = (GLXCtxInfo *)oglc->ctxInfo;
|
|
296 |
|
|
297 |
// make the context current
|
|
298 |
if (!j2d_glXMakeContextCurrent(awt_display,
|
|
299 |
dstGLXOps->drawable,
|
|
300 |
srcGLXOps->drawable,
|
|
301 |
ctxinfo->context))
|
|
302 |
{
|
|
303 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
304 |
"OGLSD_MakeOGLContextCurrent: could not make current");
|
|
305 |
return NULL;
|
|
306 |
}
|
|
307 |
|
|
308 |
if (OGLC_IS_CAP_PRESENT(oglc, CAPS_EXT_FBOBJECT)) {
|
|
309 |
// the GL_EXT_framebuffer_object extension is present, so we
|
|
310 |
// must bind to the default (windowing system provided)
|
|
311 |
// framebuffer
|
|
312 |
j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
|
313 |
}
|
|
314 |
}
|
|
315 |
|
|
316 |
return oglc;
|
|
317 |
}
|
|
318 |
|
|
319 |
/**
|
|
320 |
* This function initializes a native window surface and caches the window
|
|
321 |
* bounds in the given OGLSDOps. Returns JNI_TRUE if the operation was
|
|
322 |
* successful; JNI_FALSE otherwise.
|
|
323 |
*/
|
|
324 |
jboolean
|
|
325 |
OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo)
|
|
326 |
{
|
|
327 |
GLXSDOps *glxsdo;
|
|
328 |
Window window;
|
|
329 |
#ifdef XAWT
|
|
330 |
XWindowAttributes attr;
|
|
331 |
#else
|
|
332 |
Widget widget;
|
|
333 |
#endif
|
|
334 |
|
|
335 |
J2dTraceLn(J2D_TRACE_INFO, "OGLSD_InitOGLWindow");
|
|
336 |
|
|
337 |
if (oglsdo == NULL) {
|
|
338 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
339 |
"OGLSD_InitOGLWindow: ops are null");
|
|
340 |
return JNI_FALSE;
|
|
341 |
}
|
|
342 |
|
|
343 |
glxsdo = (GLXSDOps *)oglsdo->privOps;
|
|
344 |
if (glxsdo == NULL) {
|
|
345 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
346 |
"OGLSD_InitOGLWindow: glx ops are null");
|
|
347 |
return JNI_FALSE;
|
|
348 |
}
|
|
349 |
|
|
350 |
#ifdef XAWT
|
|
351 |
window = glxsdo->window;
|
|
352 |
if (window == 0) {
|
|
353 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
354 |
"OGLSD_InitOGLWindow: window is invalid");
|
|
355 |
return JNI_FALSE;
|
|
356 |
}
|
|
357 |
|
|
358 |
XGetWindowAttributes(awt_display, window, &attr);
|
|
359 |
oglsdo->width = attr.width;
|
|
360 |
oglsdo->height = attr.height;
|
|
361 |
#else
|
|
362 |
widget = glxsdo->widget;
|
|
363 |
if (widget == NULL) {
|
|
364 |
J2dTraceLn(J2D_TRACE_WARNING, "OGLSD_InitOGLWindow: widget is null");
|
|
365 |
}
|
|
366 |
|
|
367 |
if (!XtIsRealized(widget)) {
|
|
368 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
369 |
"OGLSD_InitOGLWindow: widget is unrealized");
|
|
370 |
return JNI_FALSE;
|
|
371 |
}
|
|
372 |
|
|
373 |
window = XtWindow(widget);
|
|
374 |
oglsdo->width = widget->core.width;
|
|
375 |
oglsdo->height = widget->core.height;
|
|
376 |
#endif
|
|
377 |
|
|
378 |
oglsdo->drawableType = OGLSD_WINDOW;
|
|
379 |
oglsdo->isOpaque = JNI_TRUE;
|
|
380 |
oglsdo->xOffset = 0;
|
|
381 |
oglsdo->yOffset = 0;
|
|
382 |
glxsdo->drawable = window;
|
|
383 |
glxsdo->xdrawable = window;
|
|
384 |
|
|
385 |
J2dTraceLn2(J2D_TRACE_VERBOSE, " created window: w=%d h=%d",
|
|
386 |
oglsdo->width, oglsdo->height);
|
|
387 |
|
|
388 |
return JNI_TRUE;
|
|
389 |
}
|
|
390 |
|
|
391 |
static int
|
|
392 |
GLXSD_BadAllocXErrHandler(Display *display, XErrorEvent *xerr)
|
|
393 |
{
|
|
394 |
int ret = 0;
|
|
395 |
if (xerr->error_code == BadAlloc) {
|
|
396 |
surfaceCreationFailed = JNI_TRUE;
|
|
397 |
} else {
|
|
398 |
ret = (*xerror_saved_handler)(display, xerr);
|
|
399 |
}
|
|
400 |
return ret;
|
|
401 |
}
|
|
402 |
|
|
403 |
JNIEXPORT jboolean JNICALL
|
|
404 |
Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer
|
|
405 |
(JNIEnv *env, jobject glxsd,
|
|
406 |
jlong pData, jlong pConfigInfo,
|
|
407 |
jboolean isOpaque,
|
|
408 |
jint width, jint height)
|
|
409 |
{
|
|
410 |
OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData);
|
|
411 |
GLXGraphicsConfigInfo *glxinfo =
|
|
412 |
(GLXGraphicsConfigInfo *)jlong_to_ptr(pConfigInfo);
|
|
413 |
GLXSDOps *glxsdo;
|
|
414 |
GLXPbuffer pbuffer;
|
|
415 |
int attrlist[] = {GLX_PBUFFER_WIDTH, 0,
|
|
416 |
GLX_PBUFFER_HEIGHT, 0,
|
|
417 |
GLX_PRESERVED_CONTENTS, GL_FALSE, 0};
|
|
418 |
|
|
419 |
J2dTraceLn3(J2D_TRACE_INFO,
|
|
420 |
"GLXSurfaceData_initPbuffer: w=%d h=%d opq=%d",
|
|
421 |
width, height, isOpaque);
|
|
422 |
|
|
423 |
if (oglsdo == NULL) {
|
|
424 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
425 |
"GLXSurfaceData_initPbuffer: ops are null");
|
|
426 |
return JNI_FALSE;
|
|
427 |
}
|
|
428 |
|
|
429 |
glxsdo = (GLXSDOps *)oglsdo->privOps;
|
|
430 |
if (glxsdo == NULL) {
|
|
431 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
432 |
"GLXSurfaceData_initPbuffer: glx ops are null");
|
|
433 |
return JNI_FALSE;
|
|
434 |
}
|
|
435 |
|
|
436 |
if (glxinfo == NULL) {
|
|
437 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
438 |
"GLXSurfaceData_initPbuffer: glx config info is null");
|
|
439 |
return JNI_FALSE;
|
|
440 |
}
|
|
441 |
|
|
442 |
attrlist[1] = width;
|
|
443 |
attrlist[3] = height;
|
|
444 |
|
|
445 |
surfaceCreationFailed = JNI_FALSE;
|
|
446 |
EXEC_WITH_XERROR_HANDLER(
|
|
447 |
GLXSD_BadAllocXErrHandler,
|
|
448 |
pbuffer = j2d_glXCreatePbuffer(awt_display,
|
|
449 |
glxinfo->fbconfig, attrlist));
|
|
450 |
if ((pbuffer == 0) || surfaceCreationFailed) {
|
|
451 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
452 |
"GLXSurfaceData_initPbuffer: could not create glx pbuffer");
|
|
453 |
return JNI_FALSE;
|
|
454 |
}
|
|
455 |
|
|
456 |
oglsdo->drawableType = OGLSD_PBUFFER;
|
|
457 |
oglsdo->isOpaque = isOpaque;
|
|
458 |
oglsdo->width = width;
|
|
459 |
oglsdo->height = height;
|
|
460 |
oglsdo->xOffset = 0;
|
|
461 |
oglsdo->yOffset = 0;
|
|
462 |
|
|
463 |
glxsdo->drawable = pbuffer;
|
|
464 |
glxsdo->xdrawable = 0;
|
|
465 |
|
887
|
466 |
OGLSD_SetNativeDimensions(env, oglsdo, width, height);
|
|
467 |
|
2
|
468 |
return JNI_TRUE;
|
|
469 |
}
|
|
470 |
|
|
471 |
void
|
|
472 |
OGLSD_SwapBuffers(JNIEnv *env, jlong window)
|
|
473 |
{
|
|
474 |
J2dTraceLn(J2D_TRACE_INFO, "OGLSD_SwapBuffers");
|
|
475 |
|
|
476 |
if (window == 0L) {
|
|
477 |
J2dRlsTraceLn(J2D_TRACE_ERROR,
|
|
478 |
"OGLSD_SwapBuffers: window is null");
|
|
479 |
return;
|
|
480 |
}
|
|
481 |
|
|
482 |
j2d_glXSwapBuffers(awt_display, (Window)window);
|
|
483 |
}
|
|
484 |
|
|
485 |
#endif /* !HEADLESS */
|