4package com.jogamp.opengl.glu.gl2es1;
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.*;
20import com.jogamp.common.util.*;
23import java.util.HashMap;
24import java.nio.charset.Charset;
25import java.nio.charset.StandardCharsets;
78 if (curContext ==
null) {
79 throw new GLException(
"No OpenGL context current on this thread");
118 availableMipmap = ReflectionUtil.isClassAvailable(
"jogamp.opengl.glu.mipmap.Mipmap",
GLU.class.getClassLoader());
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;
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);
139 throw new IllegalArgumentException(
"Unsupported buffer type (must be one of byte, short, int, or float)");
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);
162 throw new IllegalArgumentException(
"Unsupported destination buffer type (must be byte, short, int, or float)");
164 int errno = Mipmap.gluScaleImage(
getCurrentGL2ES1(), format, widthin, heightin, typein, in,
165 widthout, heightout, typeout, out );
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());
176 throw new RuntimeException(
"Should not reach here");
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 ) );
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,
213 int height,
int format,
int type,
int userLevel,
int baseLevel,
214 int maxLevel, java.nio.Buffer data ) {
217 data = copyToByteBuffer(data);
218 return( Mipmap.gluBuild2DMipmapLevels(
getCurrentGL2ES1(), target, internalFormat, width,
219 height, format, type, userLevel, baseLevel, maxLevel, data ) );
226 int height,
int format,
int type, java.nio.Buffer data ) {
229 data = copyToByteBuffer(data);
230 return( Mipmap.gluBuild2DMipmaps(
getCurrentGL2ES1(), target, internalFormat, width, height,
231 format, type, data) );
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) );
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 ) );
Abstraction for an OpenGL rendering context.
static GLContext getCurrent()
Returns this thread current context.
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).
GLUgl2es1()
Instantiates a new OpenGL Utility Library object.
static final GL2ES1 getCurrentGL2ES1()
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.
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.
static boolean checkedMipmap
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.
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.
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.
static boolean availableMipmap
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.
static final void validateMipmap()
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.
GL2ES1 getGL2ES1()
Casts this object to the GL2ES1 interface.