本文整理汇总了Java中org.lwjgl.opengl.GL11.glPixelStorei方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glPixelStorei方法的具体用法?Java GL11.glPixelStorei怎么用?Java GL11.glPixelStorei使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glPixelStorei方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTexture
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Creates an OpenGL texture based on a given Image
* @param id OpenGL reference id to create texture in
* @param image
*/
private void createTexture(int id, Image image) {
// Set as texture 0
GL13.glActiveTexture(GL13.GL_TEXTURE0);
bind();
// Set pixel storage mode
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
// Setup texture
GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GL11.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width, image.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.buffer);
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
unbind();
}
示例2: loadCubeMap
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static int loadCubeMap(MyFile[] textureFiles) {
int texID = GL11.glGenTextures();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, texID);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
for (int i = 0; i < textureFiles.length; i++) {
TextureData data = decodeTextureFile(textureFiles[i]);
GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(),
data.getHeight(), 0, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, data.getBuffer());
}
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, 0);
return texID;
}
示例3: saveGlTexture
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void saveGlTexture(String p_saveGlTexture_0_, int p_saveGlTexture_1_, int p_saveGlTexture_2_, int p_saveGlTexture_3_, int p_saveGlTexture_4_)
{
bindTexture(p_saveGlTexture_1_);
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
for (int i = 0; i <= p_saveGlTexture_2_; ++i)
{
File file1 = new File(p_saveGlTexture_0_ + "_" + i + ".png");
int j = p_saveGlTexture_3_ >> i;
int k = p_saveGlTexture_4_ >> i;
int l = j * k;
IntBuffer intbuffer = BufferUtils.createIntBuffer(l);
int[] aint = new int[l];
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, i, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer);
intbuffer.get(aint);
BufferedImage bufferedimage = new BufferedImage(j, k, 2);
bufferedimage.setRGB(0, 0, j, k, aint, 0, j);
try
{
ImageIO.write(bufferedimage, "png", (File)file1);
logger.debug("Exported png to: {}", new Object[] {file1.getAbsolutePath()});
}
catch (Exception exception)
{
logger.debug((String)"Unable to write: ", (Throwable)exception);
}
}
}
示例4: loadTextureToOpenGL
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected static int loadTextureToOpenGL(TextureData data, TextureBuilder builder) {
int texID = GL11.glGenTextures();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL12.GL_BGRA,
GL11.GL_UNSIGNED_BYTE, data.getBuffer());
if (builder.isMipmap()) {
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
if (builder.isAnisotropic() && GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
4.0f);
}
} else if (builder.isNearest()) {
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
} else {
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
}
if (builder.isClampEdges()) {
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
} else {
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
return texID;
}
示例5: glPixelStorei
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void glPixelStorei(int p_187425_0_, int p_187425_1_)
{
GL11.glPixelStorei(p_187425_0_, p_187425_1_);
}
示例6: saveGlTexture
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void saveGlTexture(String p_saveGlTexture_0_, int p_saveGlTexture_1_, int p_saveGlTexture_2_, int p_saveGlTexture_3_, int p_saveGlTexture_4_)
{
bindTexture(p_saveGlTexture_1_);
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
File file1 = new File(p_saveGlTexture_0_);
File file2 = file1.getParentFile();
if (file2 != null)
{
file2.mkdirs();
}
for (int i = 0; i < 16; ++i)
{
File file3 = new File(p_saveGlTexture_0_ + "_" + i + ".png");
file3.delete();
}
for (int i1 = 0; i1 <= p_saveGlTexture_2_; ++i1)
{
File file4 = new File(p_saveGlTexture_0_ + "_" + i1 + ".png");
int j = p_saveGlTexture_3_ >> i1;
int k = p_saveGlTexture_4_ >> i1;
int l = j * k;
IntBuffer intbuffer = BufferUtils.createIntBuffer(l);
int[] aint = new int[l];
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, i1, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer);
intbuffer.get(aint);
BufferedImage bufferedimage = new BufferedImage(j, k, 2);
bufferedimage.setRGB(0, 0, j, k, aint, 0, j);
try
{
ImageIO.write(bufferedimage, "png", (File)file4);
Config.dbg("Exported: " + file4);
}
catch (Exception exception)
{
Config.warn("Error writing: " + file4);
Config.warn("" + exception.getClass().getName() + ": " + exception.getMessage());
}
}
}