List of usage examples for org.lwjgl.opengl GL11 glGenTextures
public static void glGenTextures(@NativeType("GLuint *") int[] textures)
From source file:v9t9.gui.client.swt.gl.TextureLoader.java
License:Open Source License
/** * Create a new texture ID //w w w . j a v a2 s. co m * * @return A new texture ID */ private int createTextureID() { IntBuffer tmp = createIntBuffer(1); GL11.glGenTextures(tmp); return tmp.get(0); }
From source file:zildo.fwk.gfx.engine.TextureEngine.java
License:Open Source License
public void generateTexture() { // Create A IntBuffer For Image Address In Memory IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(buf); // Create Texture In OpenGL GL11.glBindTexture(GL11.GL_TEXTURE_2D, buf.get(0)); // Typical Texture Generation Using Data From The Image int wrapping = GL11.GL_REPEAT; // Wrap texture (useful for cloud) GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrapping); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, wrapping); int filtering = GL11.GL_NEAREST; // Linear Filtering GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filtering); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filtering); // Generate The Texture GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, textureFormat, 256, 256, 0, textureFormat, GL11.GL_UNSIGNED_BYTE, scratch);//from ww w. j a v a 2s .com // Reset bytebuffer scratch scratch.clear(); // Store texture id textureTab[n_Texture] = buf.get(0); // Ready for next one n_Texture++; }
From source file:zildo.fwk.opengl.Utils.java
License:Open Source License
public static int generateTexture(int sizeX, int sizeY) { IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(buf); // Create Texture In OpenGL int textureID = buf.get(0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, adjustTexSize(sizeX), adjustTexSize(sizeY), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null); return textureID; }
From source file:zildo.platform.engine.LwjglTextureEngine.java
License:Open Source License
@Override public int doGenerateTexture() { scratch.position(0);/*from w w w . j a v a2 s. c om*/ // Create A IntBuffer For Image Address In Memory IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(buf); // Create Texture In OpenGL GL11.glBindTexture(GL11.GL_TEXTURE_2D, buf.get(0)); // Typical Texture Generation Using Data From The Image int wrapping = GL11.GL_REPEAT; // Wrap texture (useful for cloud) GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrapping); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, wrapping); int filtering = GL11.GL_NEAREST; // Linear Filtering GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filtering); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filtering); // Generate The Texture GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, getTextureFormat(), 256, 256, 0, getTextureFormat(), GL11.GL_UNSIGNED_BYTE, scratch); return buf.get(0); }
From source file:zildo.platform.opengl.GLUtils.java
License:Open Source License
public static int generateTexture(int sizeX, int sizeY) { IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(buf); // Create Texture In OpenGL int textureID = buf.get(0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, ZUtils.adjustTexSize(sizeX), ZUtils.adjustTexSize(sizeY), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null); return textureID; }