本文整理汇总了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);
}