List of usage examples for org.lwjgl.opengl GL13 GL_TEXTURE_CUBE_MAP_POSITIVE_X
int GL_TEXTURE_CUBE_MAP_POSITIVE_X
To view the source code for org.lwjgl.opengl GL13 GL_TEXTURE_CUBE_MAP_POSITIVE_X.
Click Source Link
From source file:com.github.begla.blockmania.world.horizon.Skysphere.java
License:Apache License
private void loadStarTextures() { int internalFormat = GL11.GL_RGBA8, format = GL12.GL_BGRA; GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, _textureIds.get(0)); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL12.GL_TEXTURE_WRAP_R, GL12.GL_CLAMP_TO_EDGE); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); for (int i = 0; i < 6; i++) { byte[] data = TextureManager.getInstance().getTexture("stars" + (i + 1)).getTextureData(); ByteBuffer byteBuffer = BufferUtils.createByteBuffer(data.length); byteBuffer.put(data);// w ww . j a v a 2 s .co m byteBuffer.flip(); GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internalFormat, 256, 256, 0, format, GL11.GL_UNSIGNED_BYTE, byteBuffer); } }
From source file:com.opengrave.og.light.TextureCubeShadowMap.java
License:Open Source License
public TextureCubeShadowMap(int size) { texture = GL11.glGenTextures();//from w w w.java 2 s.c om GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, texture); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); Util.checkErr(); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); Util.checkErr(); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); Util.checkErr(); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); Util.checkErr(); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL12.GL_TEXTURE_WRAP_R, GL12.GL_CLAMP_TO_EDGE); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL14.GL_TEXTURE_COMPARE_MODE, GL11.GL_NONE); GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL14.GL_DEPTH_TEXTURE_MODE, GL11.GL_INTENSITY); // GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, // GL12.GL_TEXTURE_BASE_LEVEL, 0); // GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, // GL12.GL_TEXTURE_MAX_LEVEL, 0); for (int i = 0; i < 6; i++) { GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_DEPTH_COMPONENT, size, size, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (FloatBuffer) null); } Util.checkErr(); GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, 0); // texture2 = GL11.glGenTextures(); // GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture2); // GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0,GL11.GL_RGB, size, size, // 0,GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (FloatBuffer)null); // 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); // 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); // GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); }
From source file:com.opengrave.og.light.TextureCubeShadowMap.java
License:Open Source License
public void bindToFrameBuffer(int direction) { GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + direction, texture, 0); Util.checkErr();// w w w. j av a 2s . c o m // GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, // GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture2, 0); // Util.checkErr(); }
From source file:com.opengrave.og.MainThread.java
License:Open Source License
private void initLighting() { CubeData.data.add(new CubeData(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X, new Vector3f(1f, 0f, 0f), new Vector3f(0f, -1f, 0f))); CubeData.data.add(new CubeData(GL13.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, new Vector3f(-1f, 0f, 0f), new Vector3f(0f, -1f, 0f))); CubeData.data.add(new CubeData(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, new Vector3f(0f, 1f, 0f), new Vector3f(0f, 0f, 1f))); CubeData.data.add(new CubeData(GL13.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, new Vector3f(0f, -1f, 0f), new Vector3f(0f, 0f, -1f))); CubeData.data.add(new CubeData(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, new Vector3f(0f, 0f, 1f), new Vector3f(0f, -1f, 0f))); CubeData.data.add(new CubeData(GL13.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, new Vector3f(0f, 0f, -1f), new Vector3f(0f, -1f, 0f))); }
From source file:com.samrj.devil.gl.FBO.java
License:Open Source License
/** * Attaches a face of the given cubemap texture to this frame buffer. This * frame buffer must be bound.//w w w. java2 s . c om * * @param texture The 2D texture array to attach. * @param face The face of the given cubemap to attach. * @param attachment The attachment type. */ public void textureCubemap(TextureCubemap texture, int face, int attachment) { ensureBound(); if (face < 0 || face >= 6) throw new ArrayIndexOutOfBoundsException(); GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, attachment, GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture.id, 0); }
From source file:com.xrbpowered.gl.res.textures.CubeTexture.java
License:Open Source License
public CubeTexture(String pathFormat) { try {// w ww.jav a2 s . c o m texId = GL11.glGenTextures(); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, texId); IntBuffer buf = null; for (int i = 0; i < 6; i++) { // BufferedImage img = load(new FileInputStream(String.format("assets/"+pathFormat, FACE_NAMES[i]))); BufferedImage img = AssetManager.defaultAssets.loadImage(String.format(pathFormat, FACE_NAMES[i])); buf = getPixels(img, buf); put(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, img.getWidth(), img.getHeight(), buf); } 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.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL12.GL_TEXTURE_WRAP_R, GL12.GL_CLAMP_TO_EDGE); GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, 0); Client.checkError(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } }
From source file:dataAccess.lwjgl.VAO_Loader.java
public static int loadCubeMap(String... textureFiles) { int texID = GL11.glGenTextures(); GL13.glActiveTexture(texID);//from www .ja va 2s . c om GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, texID); for (int i = 0; i < textureFiles.length; i++) { TextureData data = dataAccess.fileLoaders.TextureLoader .decodeTextureFile("res/textures/skybox/" + textureFiles[i] + ".png"); GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL11.GL_RGBA, 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); textureMap.put("cubeMap", texID); return texID; }