2362N/A * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * The following methods are implemented in the windowing system (i.e. GLX 0N/A * and WGL) source files. 0N/A * This table contains the "pixel formats" for all system memory surfaces 0N/A * that OpenGL is capable of handling, indexed by the "PF_" constants defined 0N/A * passed to OpenGL when copying from a system memory ("Sw") surface to 0N/A * an OpenGL "Surface" (via glDrawPixels()) or "Texture" (via glTexImage2D()). 0N/A 4,
1, 0, },
/* 0 - IntArgb */ 0N/A 4,
1,
1, },
/* 1 - IntArgbPre */ 0N/A 4, 0,
1, },
/* 2 - IntRgb */ 0N/A 4, 0,
1, },
/* 3 - IntRgbx */ 0N/A 4, 0,
1, },
/* 4 - IntBgr */ 0N/A 4, 0,
1, },
/* 5 - IntBgrx */ 0N/A 2, 0,
1, },
/* 6 - Ushort565Rgb */ 0N/A 2, 0,
1, },
/* 7 - Ushort555Rgb */ 0N/A 2, 0,
1, },
/* 8 - Ushort555Rgbx*/ 0N/A 1, 0,
1, },
/* 9 - ByteGray */ 0N/A 2, 0,
1, },
/*10 - UshortGray */ 759N/A 1, 0,
1, },
/*11 - ThreeByteBgr */};
0N/A * Given a starting value and a maximum limit, returns the first power-of-two 0N/A * greater than the starting value. If the resulting value is greater than 0N/A * the maximum limit, zero is returned. 0N/A * Returns true if both given dimensions are a power of two. 0N/A * Initializes an OpenGL texture object. 0N/A * If the isOpaque parameter is JNI_FALSE, then the texture will have a 0N/A * full alpha channel; otherwise, the texture will be opaque (this can 0N/A * help save VRAM when translucency is not needed). 0N/A * If the GL_ARB_texture_non_power_of_two extension is present (texNonPow2 0N/A * is JNI_TRUE), the actual texture is allowed to have non-power-of-two 0N/A * dimensions, and therefore width==textureWidth and height==textureHeight. 0N/A * Failing that, if the GL_ARB_texture_rectangle extension is present 0N/A * (texRect is JNI_TRUE), the actual texture is allowed to have 0N/A * non-power-of-two dimensions, except that instead of using the usual 0N/A * GL_TEXTURE_2D target, we need to use the GL_TEXTURE_RECTANGLE_ARB target. 0N/A * Note that the GL_REPEAT wrapping mode is not allowed with this target, 0N/A * so if that mode is needed (e.g. as is the case in the TexturePaint code) 0N/A * one should pass JNI_FALSE to avoid using this extension. Also note that 0N/A * when the texture target is GL_TEXTURE_RECTANGLE_ARB, texture coordinates 0N/A * must be specified in the range [0,width] and [0,height] rather than 0N/A * [0,1] as is the case with the usual GL_TEXTURE_2D target (so take care)! 0N/A * Otherwise, the actual texture must have power-of-two dimensions, and 0N/A * therefore the textureWidth and textureHeight will be the next 0N/A * power-of-two greater than (or equal to) the requested width and height. 0N/A "OGLSD_InitTextureObject: w=%d h=%d opq=%d nonpow2=%d",
0N/A "OGLSD_InitTextureObject: ops are null");
0N/A // use non-pow2 dimensions with GL_TEXTURE_2D target 0N/A // use non-pow2 dimensions with GL_TEXTURE_RECTANGLE_ARB target 0N/A // find the appropriate power-of-two dimensions 0N/A " desired texture dimensions: w=%d h=%d max=%d",
0N/A // if either dimension is 0, we cannot allocate a texture with the 0N/A // requested dimensions 0N/A "OGLSD_InitTextureObject: texture dimensions too large");
0N/A // now use a proxy to determine whether we can create a texture with 0N/A // the calculated power-of-two dimensions and the given internal format 0N/A // if the requested dimensions and proxy dimensions don't match, 0N/A // we shouldn't attempt to create the texture 0N/A "OGLSD_InitTextureObject: actual (w=%d h=%d) != requested",
0N/A // initialize the texture with some dummy data (this allows us to create 0N/A // a texture object once with 2^n dimensions, and then use 0N/A // glTexSubImage2D() to provide further updates) 0N/A * Initializes an OpenGL texture, using the given width and height as 0N/A * a guide. See OGLSD_InitTextureObject() for more information. 0N/A "OGLSurfaceData_initTexture: ops are null");
0N/A * We only use the GL_ARB_texture_rectangle extension if it is available 0N/A * and the requested bounds are not pow2 (it is probably faster to use 0N/A * GL_TEXTURE_2D for pow2 textures, and besides, our TexturePaint 0N/A * code relies on GL_REPEAT, which is not allowed for 0N/A * GL_TEXTURE_RECTANGLE_ARB targets). 0N/A "OGLSurfaceData_initTexture: could not init texture object");
0N/A // other fields (e.g. width, height) are set in OGLSD_InitTextureObject() 0N/A * Initializes a framebuffer object based on the given textureID and its 0N/A * width/height. This method will iterate through all possible depth formats 0N/A * the depth buffer is fairly simplistic, we hope to find a depth format that 0N/A * uses as little VRAM as possible.) If an appropriate depth buffer is found 0N/A * and all attachments are successful (i.e. the framebuffer object is 0N/A * "complete"), then this method will return JNI_TRUE and will initialize 0N/A * the values of fbobjectID and depthID using the IDs created by this method. 0N/A * Otherwise, this method returns JNI_FALSE. Note that the caller is only 0N/A * responsible for deleting the allocated fbobject and depth renderbuffer 0N/A * resources if this method returned JNI_TRUE. 0N/A // initialize framebuffer object 0N/A // attach color texture to framebuffer object 0N/A // attempt to create a depth renderbuffer of a particular format; we 0N/A // will start with the smallest size and then work our way up 0N/A for (i = 0; i <
3; i++) {
0N/A // initialize depth renderbuffer 0N/A // creation of depth buffer could potentially fail, so check for error 0N/A "OGLSD_InitFBObject: could not create depth buffer: depth=%d error=%x",
0N/A // attach depth renderbuffer to framebuffer object 0N/A // now check for framebuffer "completeness" 0N/A // we found a valid format, so break out of the loop 0N/A // this depth format didn't work, so delete and try another format 0N/A " framebuffer is incomplete: depth=%d status=%x",
0N/A // unbind the texture and framebuffer objects (they will be bound again 0N/A "OGLSD_InitFBObject: could not find valid depth format");
0N/A * Initializes a framebuffer object, using the given width and height as 0N/A * a guide. See OGLSD_InitTextureObject() and OGLSD_InitFBObject() 0N/A * for more information. 0N/A "OGLSurfaceData_initFBObject: w=%d h=%d",
0N/A "OGLSurfaceData_initFBObject: ops are null");
0N/A // initialize color texture object 0N/A "OGLSurfaceData_initFBObject: could not init texture object");
0N/A // initialize framebuffer object using color texture created above 0N/A "OGLSurfaceData_initFBObject: could not init fbobject");
0N/A // other fields (e.g. width, height) are set in OGLSD_InitTextureObject() 0N/A // framebuffer objects differ from other OpenGL surfaces in that the 0N/A // rather than GL_FRONT (or GL_BACK) 0N/A * Initializes a surface in the backbuffer of a given double-buffered 0N/A * onscreen window for use in a BufferStrategy.Flip situation. The bounds of 0N/A * the backbuffer surface should always be kept in sync with the bounds of 0N/A * the underlying native window. 0N/A "OGLSurfaceData_initFlipBackbuffer: ops are null");
0N/A "OGLSurfaceData_initFlipBackbuffer: could not init window");
0N/A "OGLSurfaceData_initFlipBackbuffer: drawable is not a window");
0N/A // x/yOffset have already been set in OGLSD_InitOGLWindow()... 0N/A // REMIND: for some reason, flipping won't work properly on IFB unless we 0N/A // explicitly use BACK_LEFT rather than BACK... 0N/A "OGLSurfaceData_getTextureTarget: ops are null");
430N/A "OGLSurfaceData_getTextureID: ops are null");
4632N/A * Deletes native OpenGL resources associated with this surface. 0N/A // dispose windowing system resources (pbuffer, pixmap, etc) 0N/A * This is the implementation of the general DisposeFunc defined in 0N/A * native OpenGL resources and then frees any memory allocated within the 0N/A * native OGLSDOps structure. 0N/A * This is the implementation of the general surface LockFunc defined in 0N/A * This is the implementation of the general GetRasInfoFunc defined in 0N/A * This is the implementation of the general surface UnlockFunc defined in 0N/A#
endif /* !HEADLESS */