1package com.jogamp.opengl.test.junit.jogl.glu;
3import java.nio.ByteBuffer;
5import com.jogamp.opengl.GL;
6import com.jogamp.opengl.GL2;
7import com.jogamp.opengl.GL2ES2;
8import com.jogamp.opengl.GLCapabilities;
9import com.jogamp.opengl.GLContext;
10import com.jogamp.opengl.GLDrawableFactory;
11import com.jogamp.opengl.GLOffscreenAutoDrawable;
12import com.jogamp.opengl.GLProfile;
14import org.junit.AfterClass;
15import org.junit.Assert;
16import org.junit.BeforeClass;
17import org.junit.FixMethodOrder;
19import org.junit.runners.MethodSorters;
21import jogamp.opengl.glu.mipmap.Mipmap;
22import jogamp.opengl.glu.mipmap.ScaleInternal;
24import com.jogamp.common.nio.Buffers;
25import com.jogamp.opengl.test.junit.util.UITestCase;
26import com.jogamp.opengl.util.texture.Texture;
27import com.jogamp.opengl.util.texture.TextureData;
28import com.jogamp.opengl.util.texture.TextureIO;
52@FixMethodOrder(MethodSorters.NAME_ASCENDING)
57 public static void setup() throws Throwable {
59 System.setProperty(
"jogl.texture.nonpot",
"true");
61 setUpOffscreenAutoDrawable();
62 }
catch (
final Throwable t) {
69 tearDownOffscreenAutoDrawable();
72 private static void setUpOffscreenAutoDrawable() throws Throwable {
84 }
catch (
final Throwable t) {
85 tearDownOffscreenAutoDrawable();
90 private static void tearDownOffscreenAutoDrawable() {
91 if(drawable !=
null) {
98 private static void testTextureMipMapGeneration(
final int width,
final int height,
final int pixelFormat,
final int pixelType) {
99 final int internalFormat = pixelFormat;
100 final int border = 0;
101 final boolean mipmap =
true;
102 final boolean dataIsCompressed =
false;
103 final boolean mustFlipVertically =
false;
105 final int memReq = Mipmap.image_size( width, height, pixelFormat, pixelType );
106 ByteBuffer buffer = Buffers.newDirectByteBuffer( memReq );
108 final TextureData data =
new TextureData(drawable.
getGLProfile(),
121 final Texture texture = TextureIO.newTexture(drawable.
getGL(), data);
123 texture.destroy(drawable.
getGL());
132 final int height = 7;
136 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
142 final int height = 7;
146 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
152 final int height = 7;
156 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
162 final int height = 7;
166 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
172 final int height = 7;
176 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
182 final int height = 7;
186 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
192 final int height = 7;
196 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
202 final int height = 7;
206 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
212 final int height = 7;
216 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
222 final int height = 7;
226 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
232 final int height = 7;
236 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
242 final int height = 7;
246 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
252 final int height = 7;
256 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
262 final int height = 7;
266 testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
269 public static void main(
final String[] args) {
Specifies a set of OpenGL capabilities.
Abstraction for an OpenGL rendering context.
static final int CONTEXT_NOT_CURRENT
Indicates that the context was not made current during the last call to makeCurrent,...
abstract int makeCurrent()
Makes this GLContext current on the calling thread.
abstract void release()
Releases control of this GLContext from the current thread.
abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height)
Creates a realized GLOffscreenAutoDrawable incl it's offscreen NativeSurface with the given capabilit...
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
Specifies the the OpenGL profile.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
This test creates a Texture from TextureData of various pixel formats and pixel types with auto gener...
void test10_MipMap_ScaleInternal_RGB_INT()
void test06_MipMap_ScaleInternal_RGB_SHORT()
void test01_MipMap_ScaleInternal_RGBA_UBYTE()
void test08_MipMap_ScaleInternal_RGB_UINT()
void test03_MipMap_ScaleInternal_RGBA_BYTE()
static void main(final String[] args)
void test13_MipMap_ScaleInternal_RGBA_FLOAT()
void test09_MipMap_ScaleInternal_RGBA_UINT()
void test02_MipMap_ScaleInternal_RGB_BYTE()
void test04_MipMap_ScaleInternal_RGB_USHORT()
void test11_MipMap_ScaleInternal_RGBA_INT()
void test00_MipMap_ScaleInternal_RGB_UBYTE()
void test12_MipMap_ScaleInternal_RGB_FLOAT()
void test05_MipMap_ScaleInternal_RGBA_USHORT()
void test07_MipMap_ScaleInternal_RGBA_SHORT()
static final int GL_INT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0 Define "GL_INT" with expression '0x1404',...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
GLContext getContext()
Returns the context associated with this drawable.
GLProfile getGLProfile()
Fetches the GLProfile for this drawable.
Platform-independent GLAutoDrawable specialization, exposing offscreen functionality.
static final int GL_RGB
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_RGB" with expression ...
static final int GL_SHORT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_SHORT" with expressio...
static final int GL_UNSIGNED_INT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_OES_element_index_uint Define "GL_UNSIGNED_INT"...
static final int GL_FLOAT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FLOAT" with expressio...
static final int GL_UNSIGNED_SHORT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_UNSIGNED_SHORT" with ...
static final int GL_RGBA
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_RGBA" with expression...
static final int GL_UNSIGNED_BYTE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_UNSIGNED_BYTE" with e...
static final int GL_BYTE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_BYTE" with expression...