本文整理匯總了Java中javax.media.opengl.glu.GLU.gluBuild2DMipmaps方法的典型用法代碼示例。如果您正苦於以下問題:Java GLU.gluBuild2DMipmaps方法的具體用法?Java GLU.gluBuild2DMipmaps怎麽用?Java GLU.gluBuild2DMipmaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.glu.GLU
的用法示例。
在下文中一共展示了GLU.gluBuild2DMipmaps方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadTexture
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
private int loadTexture(GLAutoDrawable GLAutoDrawable, String filename)
{
GL gl = GLAutoDrawable.getGL();
GLU glu = new GLU();
int width = 128;
int height = 128;
ByteBuffer data = Medias.loadMediaIntoMemory(filename);
IntBuffer texture = newIntBuffer(SIZEOF_INT);
gl.glGenTextures(1, texture);
gl.glBindTexture(GL.GL_TEXTURE_2D, texture.get(0));
gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_NEAREST );
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR );
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
glu.gluBuild2DMipmaps(
GL.GL_TEXTURE_2D,
3,
width,
height,
GL.GL_RGB,
GL.GL_UNSIGNED_BYTE,
data);
return texture.get(0);
}
示例2: loadTexture
import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
private int loadTexture(GLAutoDrawable GLAutoDrawable, String filename)
{
GL gl = GLAutoDrawable.getGL();
GLU glu = new GLU();
int width = 128;
int height = 128;
ByteBuffer data = loadFileIntoMemory(filename);
IntBuffer texture = newIntBuffer(SIZEOF_INT);
gl.glGenTextures(1, texture);
gl.glBindTexture(GL.GL_TEXTURE_2D, texture.get(0));
gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_NEAREST );
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR );
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
glu.gluBuild2DMipmaps(
GL.GL_TEXTURE_2D,
3,
width,
height,
GL.GL_RGB,
GL.GL_UNSIGNED_BYTE,
data);
return texture.get(0);
}