当前位置: 首页>>代码示例>>Java>>正文


Java GL11.glPixelStorei方法代码示例

本文整理汇总了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();
}
 
开发者ID:tacocat,项目名称:lambda,代码行数:24,代码来源:Texture.java

示例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;
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:18,代码来源:TextureUtils.java

示例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);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:TextureUtil.java

示例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;
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:34,代码来源:TextureUtils.java

示例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_);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:GlStateManager.java

示例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());
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:45,代码来源:TextureUtils.java


注:本文中的org.lwjgl.opengl.GL11.glPixelStorei方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。