JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
GLUgl2es1.java
Go to the documentation of this file.
1/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/opengl/GLEmitter.java on Sat Jul 12 19:19:57 CEST 2025 ----! */
2/* !---- Java-Unit: [pkg com.jogamp.opengl.glu.gl2es1, cls GLUgl2es1], ../build/jogl/gensrc/classes/com/jogamp/opengl/glu/gl2es1/GLUgl2es1.java ----! */
3
4package com.jogamp.opengl.glu.gl2es1;
5
6import com.jogamp.opengl.GLES1;
7import jogamp.opengl.glu.mipmap.Mipmap;
8import com.jogamp.opengl.*;
9import com.jogamp.opengl.glu.*;
10import com.jogamp.opengl.util.glsl.ShaderState;
11import jogamp.opengl.*;
12import jogamp.opengl.glu.*;
13import jogamp.opengl.glu.tessellator.GLUtessellatorImpl;
14import jogamp.opengl.ProjectFloat;
15import com.jogamp.common.util.ReflectionUtil;
16import com.jogamp.gluegen.runtime.*;
17import com.jogamp.common.os.*;
18import com.jogamp.common.nio.*;
19import java.nio.*;
20import com.jogamp.common.util.*;
21import java.util.Set;
22import java.util.Map;
23import java.util.HashMap;
24import java.nio.charset.Charset;
25import java.nio.charset.StandardCharsets;
26
27public class GLUgl2es1 extends GLU {
28
29 // --- Begin CustomJavaCode .cfg declarations
30 /*
31 private static boolean useJavaMipmapCode = true;
32
33 static {
34 SecurityUtil.doPrivileged(new PrivilegedAction() {
35 public Object run() {
36 String val = System.getProperty("jogl.glu.nojava");
37 if (val != null && !val.toLowerCase().equals("false")) {
38 useJavaMipmapCode = false;
39 }
40 // Not required nor forced
41 // if( !initializeImpl() ) {
42 // throw new RuntimeException("Initialization failure");
43 // }
44 return null;
45 }
46 });
47 }
48 */
49
50 /**
51 * Instantiates a new OpenGL Utility Library object. A GLU object may
52 * be instantiated at any point in the application and is not
53 * inherently tied to any particular OpenGL context; however, the GLU
54 * object may only be used when an OpenGL context is current on the
55 * current thread. Attempts to call most of the methods in the GLU
56 * library when no OpenGL context is current will cause an exception
57 * to be thrown.
58 *
59 * <P>
60 *
61 * The returned GLU object is not guaranteed to be thread-safe and
62 * should only be used from one thread at a time. Multiple GLU objects
63 * may be instantiated to be used from different threads
64 * simultaneously.
65 */
66
67 public GLUgl2es1()
68 {
69 super();
70 }
71
72 //----------------------------------------------------------------------
73 // Utility routines
74 //
75
76 public static final GL2ES1 getCurrentGL2ES1() throws GLException {
77 GLContext curContext = GLContext.getCurrent();
78 if (curContext == null) {
79 throw new GLException("No OpenGL context current on this thread");
80 }
81 return curContext.getGL().getGL2ES1();
82 }
83
84
85 /*
86 public String gluErrorString(int errorCode) {
87 return Error.gluErrorString(errorCode);
88 }
89 */
90
91 /* extName is an extension name.
92 * extString is a string of extensions separated by blank(s). There may or
93 * may not be leading or trailing blank(s) in extString.
94 * This works in cases of extensions being prefixes of another like
95 * GL_EXT_texture and GL_EXT_texture3D.
96 * Returns true if extName is found otherwise it returns false.
97 */
98 /*
99 public boolean gluCheckExtension(java.lang.String extName, java.lang.String extString) {
100 return Registry.gluCheckExtension(extName, extString);
101 }
102 */
103
104 /*
105 public String gluGetString(int name) {
106 return Registry.gluGetString(name);
107 }
108 */
109
110 //----------------------------------------------------------------------
111 // Mipmap and image scaling functionality
112
113 protected static boolean availableMipmap = false;
114 protected static boolean checkedMipmap = false;
115
116 protected static final void validateMipmap() {
117 if(!checkedMipmap) {
118 availableMipmap = ReflectionUtil.isClassAvailable("jogamp.opengl.glu.mipmap.Mipmap", GLU.class.getClassLoader());
119 checkedMipmap = true;
120 }
121 if(!availableMipmap) {
122 throw new GLException("Mipmap not available");
123 }
124 }
125
126 private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) {
127 if (buf instanceof java.nio.ByteBuffer) {
128 if (buf.position() == 0) {
129 return (java.nio.ByteBuffer) buf;
130 }
131 return Buffers.copyByteBuffer((java.nio.ByteBuffer) buf);
132 } else if (buf instanceof java.nio.ShortBuffer) {
133 return Buffers.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf);
134 } else if (buf instanceof java.nio.IntBuffer) {
135 return Buffers.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf);
136 } else if (buf instanceof java.nio.FloatBuffer) {
137 return Buffers.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf);
138 } else {
139 throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
140 }
141 }
142
143 /**
144 * Optional, throws GLException if not available in profile
145 */
146 public final int gluScaleImage( int format, int widthin, int heightin,
147 int typein, java.nio.Buffer datain, int widthout, int heightout,
148 int typeout, java.nio.Buffer dataout ) {
150 java.nio.ByteBuffer in = null;
151 java.nio.ByteBuffer out = null;
152 in = copyToByteBuffer(datain);
153 if( dataout instanceof java.nio.ByteBuffer ) {
154 out = (java.nio.ByteBuffer)dataout;
155 } else if( dataout instanceof java.nio.ShortBuffer ) {
156 out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_SHORT);
157 } else if ( dataout instanceof java.nio.IntBuffer ) {
158 out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_INT);
159 } else if ( dataout instanceof java.nio.FloatBuffer ) {
160 out = Buffers.newDirectByteBuffer(dataout.remaining() * Buffers.SIZEOF_FLOAT);
161 } else {
162 throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)");
163 }
164 int errno = Mipmap.gluScaleImage( getCurrentGL2ES1(), format, widthin, heightin, typein, in,
165 widthout, heightout, typeout, out );
166 if( errno == 0 ) {
167 out.rewind();
168 if (out != dataout) {
169 if( dataout instanceof java.nio.ShortBuffer ) {
170 ((java.nio.ShortBuffer) dataout).put(out.asShortBuffer());
171 } else if( dataout instanceof java.nio.IntBuffer ) {
172 ((java.nio.IntBuffer) dataout).put(out.asIntBuffer());
173 } else if( dataout instanceof java.nio.FloatBuffer ) {
174 ((java.nio.FloatBuffer) dataout).put(out.asFloatBuffer());
175 } else {
176 throw new RuntimeException("Should not reach here");
177 }
178 }
179 }
180 return( errno );
181 }
182
183
184 /**
185 * Optional, throws GLException if not available in profile
186 */
187 public final int gluBuild1DMipmapLevels( int target, int internalFormat, int width,
188 int format, int type, int userLevel, int baseLevel, int maxLevel,
189 java.nio.Buffer data ) {
191 java.nio.ByteBuffer buffer = copyToByteBuffer(data);
192 return( Mipmap.gluBuild1DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width,
193 format, type, userLevel, baseLevel, maxLevel, buffer ) );
194 }
195
196
197 /**
198 * Optional, throws GLException if not available in profile
199 */
200 public final int gluBuild1DMipmaps( int target, int internalFormat, int width,
201 int format, int type, java.nio.Buffer data ) {
203 java.nio.ByteBuffer buffer = copyToByteBuffer(data);
204 return( Mipmap.gluBuild1DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, format,
205 type, buffer ) );
206 }
207
208
209 /**
210 * Optional, throws GLException if not available in profile
211 */
212 public final int gluBuild2DMipmapLevels( int target, int internalFormat, int width,
213 int height, int format, int type, int userLevel, int baseLevel,
214 int maxLevel, java.nio.Buffer data ) {
216 // While the code below handles other data types, it doesn't handle non-ByteBuffers
217 data = copyToByteBuffer(data);
218 return( Mipmap.gluBuild2DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width,
219 height, format, type, userLevel, baseLevel, maxLevel, data ) );
220 }
221
222 /**
223 * Optional, throws GLException if not available in profile
224 */
225 public final int gluBuild2DMipmaps( int target, int internalFormat, int width,
226 int height, int format, int type, java.nio.Buffer data ) {
228 // While the code below handles other data types, it doesn't handle non-ByteBuffers
229 data = copyToByteBuffer(data);
230 return( Mipmap.gluBuild2DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, height,
231 format, type, data) );
232 }
233
234 /**
235 * Optional, throws GLException if not available in profile
236 */
237 public final int gluBuild3DMipmapLevels( int target, int internalFormat, int width,
238 int height, int depth, int format, int type, int userLevel, int baseLevel,
239 int maxLevel, java.nio.Buffer data) {
241 java.nio.ByteBuffer buffer = copyToByteBuffer(data);
242 return( Mipmap.gluBuild3DMipmapLevels( getCurrentGL2ES1(), target, internalFormat, width,
243 height, depth, format, type, userLevel, baseLevel, maxLevel, buffer) );
244 }
245
246 /**
247 * Optional, throws GLException if not available in profile
248 */
249 public final int gluBuild3DMipmaps( int target, int internalFormat, int width,
250 int height, int depth, int format, int type, java.nio.Buffer data ) {
252 java.nio.ByteBuffer buffer = copyToByteBuffer(data);
253 return( Mipmap.gluBuild3DMipmaps( getCurrentGL2ES1(), target, internalFormat, width, height,
254 depth, format, type, buffer ) );
255 }
256
257 // ---- End CustomJavaCode .cfg declarations
258} // end of class GLUgl2es1
Abstraction for an OpenGL rendering context.
Definition: GLContext.java:74
static GLContext getCurrent()
Returns this thread current context.
Definition: GLContext.java:515
abstract GL getGL()
Returns the GL pipeline object for this GLContext.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Provides access to the OpenGL Utility Library (GLU).
Definition: GLU.java:43
GLUgl2es1()
Instantiates a new OpenGL Utility Library object.
Definition: GLUgl2es1.java:67
static final GL2ES1 getCurrentGL2ES1()
Definition: GLUgl2es1.java:76
final int gluBuild3DMipmapLevels(int target, int internalFormat, int width, int height, int depth, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:237
final int gluBuild2DMipmaps(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:225
final int gluBuild1DMipmapLevels(int target, int internalFormat, int width, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:187
final int gluScaleImage(int format, int widthin, int heightin, int typein, java.nio.Buffer datain, int widthout, int heightout, int typeout, java.nio.Buffer dataout)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:146
final int gluBuild3DMipmaps(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:249
final int gluBuild2DMipmapLevels(int target, int internalFormat, int width, int height, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:212
final int gluBuild1DMipmaps(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
Definition: GLUgl2es1.java:200
GL2ES1 getGL2ES1()
Casts this object to the GL2ES1 interface.