List of usage examples for org.lwjgl.opengl GL11 glTexParameteri
public static void glTexParameteri(@NativeType("GLenum") int target, @NativeType("GLenum") int pname, @NativeType("GLint") int param)
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void setTextureMipmapMinFilter(int filter) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, mipmapFilterToGL[filter]); }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void setTextureMipmapMagFilter(int filter) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, mipmapFilterToGL[filter]); }
From source file:junkdisplay.JunkDisplayLWJGL.java
private void initTextures() { // enable alpha blending GL11.glEnable(GL11.GL_BLEND);//from w w w .ja v a 2s.c om GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); levelmap = new TextureMapper(); levelmap.initSheet(this.getClass().getResource("/junkimages/sky_spritesheet_5_12_2014.png"), "PNG"); levelmap.addSpriteLocation("bluesky", new Rectangle2D.Float(0f, 0f, .195f, .195f)); levelmap.addSpriteLocation("cloud", new Rectangle2D.Float(0.39f, 0f, .195f, .195f)); levelmap.addSpriteLocation("sky", new Rectangle2D.Float(0f, 0.39f, .195f, .195f)); levelmap.addSpriteLocation("night", new Rectangle2D.Float(.39f, .39f, .195f, .195f)); charactermap = new TextureMapper(); charactermap.initSheet(this.getClass().getResource("/junkimages/scenery_spritesheet_5_12_2014.png"), "PNG"); charactermap.addSpriteLocation("character", new Rectangle2D.Float(.388f, .194f, .194f, .194f)); charactermap.addSpriteLocation("missle", new Rectangle2D.Float(.388f, 0f, .194f, .194f)); charactermap.addSpriteLocation("lightmissle", new Rectangle2D.Float(.582f, 0f, .194f, .194f)); charactermap.addSpriteLocation("darkmissle", new Rectangle2D.Float(.582f, .194f, .194f, .194f)); charactermap.addSpriteLocation("chaser", new Rectangle2D.Float(.194f, .582f, .194f, .194f)); charactermap.addSpriteLocation("crawler", new Rectangle2D.Float(.194f, .582f, .194f, .194f)); charactermap.addSpriteLocation("bulker", new Rectangle2D.Float(0f, 0f, .194f, .194f)); charactermap.addSpriteLocation("lightitem", new Rectangle2D.Float(0f, .194f, .194f, .194f)); charactermap.addSpriteLocation("item", new Rectangle2D.Float(.194f, 0f, .194f, .194f)); charactermap.addSpriteLocation("darkitem", new Rectangle2D.Float(.194f, .194f, .194f, .194f)); /*charactermap.addSpriteLocation("character", new Rectangle2D.Float(.588f, .2f, .194f, .294f)); charactermap.addSpriteLocation("missle", new Rectangle2D.Float(.788f, .2f, .09f, .09f)); charactermap.addSpriteLocation("lightmissle", new Rectangle2D.Float(.832f, 0f, .084f, .084f)); charactermap.addSpriteLocation("darkmissle", new Rectangle2D.Float(.582f, .194f, .194f, .194f)); charactermap.addSpriteLocation("chaser", new Rectangle2D.Float(.194f, .582f, .194f, .194f)); charactermap.addSpriteLocation("crawler", new Rectangle2D.Float(.204f, .592f, .19f, .11f)); charactermap.addSpriteLocation("bulker", new Rectangle2D.Float(0f, 0f, .554f, .594f)); charactermap.addSpriteLocation("lightitem", new Rectangle2D.Float(0f, .194f, .194f, .194f)); charactermap.addSpriteLocation("item", new Rectangle2D.Float(.194f, 0f, .194f, .194f)); charactermap.addSpriteLocation("darkitem", new Rectangle2D.Float(.194f, .194f, .194f, .194f)); */ newscenerymap = new TextureMapper(); newscenerymap.initSheet(this.getClass().getResource("/junkimages/scenery_spritesheet_5_12_2014.png"), "PNG"); newscenerymap.addSpriteLocation("floor", new Rectangle2D.Float(0f, .392f, .194f, .194f)); newscenerymap.addSpriteLocation("block", new Rectangle2D.Float(0f, .585f, .194f, .194f)); newscenerymap.addSpriteLocation("tallblock", new Rectangle2D.Float(.197f, .393f, .192f, .191f)); newscenerymap.addSpriteLocation("darkblock", new Rectangle2D.Float(.585f, .39f, .194f, .194f)); newscenerymap.addSpriteLocation("woodblock", new Rectangle2D.Float(.388f, .582f, .194f, .194f)); scenerymap = new TextureMapper(); scenerymap.initSheet(this.getClass().getResource("/junkimages/scenery_spritesheet_18_11_2014.png"), "PNG"); scenerymap.addSpriteLocation("mossflat", new Rectangle2D.Float(0f, 0f, .299f, .064f)); scenerymap.addSpriteLocation("mosscurve", new Rectangle2D.Float(0f, .0643f, .3f, .064f)); scenerymap.addSpriteLocation("platform", new Rectangle2D.Float(0f, .13f, .3f, .05f)); scenerymap.addSpriteLocation("iceplatform", new Rectangle2D.Float(0f, .18f, .3f, .025f)); scenerymap.addSpriteLocation("fatplatform", new Rectangle2D.Float(0f, .205f, .295f, .075f)); scenerymap.addSpriteLocation("largestalactite", new Rectangle2D.Float(0f, 0.293f, .29f, .52f)); scenerymap.addSpriteLocation("largestalagmite", new Rectangle2D.Float(.3f, 0f, .285f, .52f)); scenerymap.addSpriteLocation("smallstalagmite", new Rectangle2D.Float(.267f, .518f, .238f, .33f)); scenerymap.addSpriteLocation("smallstalactite", new Rectangle2D.Float(.585f, 0f, .238f, .33f)); scenerymap.addSpriteLocation("squareplatform", new Rectangle2D.Float(.587f, .33f, .197f, .197f)); scenerymap.addSpriteLocation("leftmoss", new Rectangle2D.Float(.5f, .5275f, .181f, .064f)); scenerymap.addSpriteLocation("rightmoss", new Rectangle2D.Float(.5f, .5915f, .181f, .064f)); interactivemap = new TextureMapper(); interactivemap.initSheet(this.getClass().getResource("/junkimages/interactive_spritesheet_22_11_2014.png"), "PNG"); interactivemap.addSpriteLocation("iceright", new Rectangle2D.Float(0f, 0f, .1325f, .85f)); interactivemap.addSpriteLocation("rockright", new Rectangle2D.Float(.1325f, 0f, .1325f, .85f)); interactivemap.addSpriteLocation("iceleft", new Rectangle2D.Float(.265f, 0f, .1325f, .85f)); interactivemap.addSpriteLocation("rockleft", new Rectangle2D.Float(.3975f, 0f, .1325f, .85f)); decorationmap = new TextureMapper(); decorationmap.initSheet(this.getClass().getResource("/junkimages/decoration_spritesheet_18_11_2014.png"), "PNG"); decorationmap.addSpriteLocation("grass", new Rectangle2D.Float(0f, 0f, .6f, .046f)); decorationmap.addSpriteLocation("shroom1", new Rectangle2D.Float(0f, .05f, .205f, .162f)); decorationmap.addSpriteLocation("shroom2", new Rectangle2D.Float(0f, .212f, .205f, .162f)); decorationmap.addSpriteLocation("shroom3", new Rectangle2D.Float(.205f, .048f, .21f, .165f)); decorationmap.addSpriteLocation("shroom4", new Rectangle2D.Float(.205f, .216f, .21f, .165f)); decorationmap.addSpriteLocation("grass1", new Rectangle2D.Float(.415f, .05f, .153f, .37f)); decorationmap.addSpriteLocation("grass2", new Rectangle2D.Float(.588f, 0f, .153f, .37f)); decorationmap.addSpriteLocation("grass3", new Rectangle2D.Float(.75f, 0f, .153f, .37f)); decorationmap.addSpriteLocation("grass4", new Rectangle2D.Float(0f, .375f, .1528f, .37f)); decorationmap.addSpriteLocation("shroom", new Rectangle2D.Float(.153f, .375f, .152f, .162f)); moredecorationmap = new TextureMapper(); moredecorationmap.initSheet( this.getClass().getResource("/junkimages/moredecoration_spritesheet_3_12_2014.png"), "PNG"); moredecorationmap.addSpriteLocation("grass", new Rectangle2D.Float(0f, 0f, .6f, .046f)); threatmap = new TextureMapper(); //threatmap.initSheet(this.getClass().getResource("/junkimages/fire_spritesheet.png"), "PNG"); //threatmap.addSpriteLocation("fire1", new Rectangle2D.Float(.00f, 0f, .33f, 1f)); //threatmap.addSpriteLocation("fire2", new Rectangle2D.Float(.298f, 0f, .333333f, 1f)); //threatmap.addSpriteLocation("fire3", new Rectangle2D.Float(.61f, 0f, .333333f, 1f)); threatmap.initSheet(this.getClass().getResource("/junkimages/fireice_spritesheet_16_11_2014.png"), "PNG"); threatmap.addSpriteLocation("fire1", new Rectangle2D.Float(.00f, 0f, .156f, .41f)); threatmap.addSpriteLocation("fire2", new Rectangle2D.Float(.156f, 0f, .156f, .41f)); threatmap.addSpriteLocation("fire3", new Rectangle2D.Float(.312f, 0f, .156f, .41f)); threatmap.addSpriteLocation("ice1", new Rectangle2D.Float(.47f, 0f, .15f, .41f)); threatmap.addSpriteLocation("ice2", new Rectangle2D.Float(.0f, .4f, .15f, .41f)); threatmap.addSpriteLocation("ice3", new Rectangle2D.Float(.1f, .4f, .15f, .41f)); healingmap = new TextureMapper(); healingmap.initSheet(this.getClass().getResource("/junkimages/pooldrip_spritesheet_16_11_2014.png"), "PNG"); healingmap.addSpriteLocation("pool1", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool2", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool3", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool4", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool5", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("drop1", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop2", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop3", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop4", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop5", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop6", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop7", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healthmap = new TextureMapper(); healthmap.initSheet(this.getClass().getResource("/junkimages/waterhealth_spritesheet_11_11_2014.png"), "PNG"); healthmap.addSpriteLocation("10", new Rectangle2D.Float(0f, 0f, .25f, .25f)); healthmap.addSpriteLocation("20", new Rectangle2D.Float(0f, .25f, .25f, .25f)); healthmap.addSpriteLocation("30", new Rectangle2D.Float(.25f, .25f, .25f, .25f)); healthmap.addSpriteLocation("40", new Rectangle2D.Float(.5f, 0f, .25f, .25f)); healthmap.addSpriteLocation("50", new Rectangle2D.Float(.5f, .25f, .25f, .25f)); healthmap.addSpriteLocation("60", new Rectangle2D.Float(.75f, 0f, .25f, .25f)); healthmap.addSpriteLocation("70", new Rectangle2D.Float(.75f, .25f, .25f, .25f)); healthmap.addSpriteLocation("80", new Rectangle2D.Float(0f, .5f, .25f, .25f)); healthmap.addSpriteLocation("90", new Rectangle2D.Float(0f, .75f, .25f, .25f)); healthmap.addSpriteLocation("100", new Rectangle2D.Float(.25f, 0f, .25f, .25f)); healthmap.addSpriteLocation("0", new Rectangle2D.Float(.9f, .9f, .01f, .01f)); healthmap.addSpriteLocation("porthole", new Rectangle2D.Float(.25f, .5f, .25f, .25f)); numbermap = new TextureMapper(); numbermap.initSheet(this.getClass().getResource("/junkimages/number_spritesheet_11_11_2014.png"), "PNG"); numbermap.addSpriteLocation("0", new Rectangle2D.Float(0f, 0f, .2f, .2f)); numbermap.addSpriteLocation("1", new Rectangle2D.Float(.21f, 0f, .2f, .2f)); numbermap.addSpriteLocation("2", new Rectangle2D.Float(.42f, 0f, .2f, .2f)); numbermap.addSpriteLocation("3", new Rectangle2D.Float(.63f, 0f, .2f, .2f)); numbermap.addSpriteLocation("4", new Rectangle2D.Float(0f, .206f, .2f, .2f)); numbermap.addSpriteLocation("5", new Rectangle2D.Float(.21f, .206f, .2f, .2f)); numbermap.addSpriteLocation("6", new Rectangle2D.Float(.42f, .206f, .2f, .206f)); numbermap.addSpriteLocation("7", new Rectangle2D.Float(.63f, .206f, .2f, .206f)); numbermap.addSpriteLocation("8", new Rectangle2D.Float(0f, .41f, .2f, .206f)); numbermap.addSpriteLocation("9", new Rectangle2D.Float(.21f, .41f, .2f, .206f)); numbermap.addSpriteLocation("blank", new Rectangle2D.Float(.63f, .41f, .2f, .206f)); temperaturemap = new TextureMapper(); temperaturemap.initSheet(this.getClass().getResource("/junkimages/temperature_spritesheet_17_11_2014.png"), "PNG"); temperaturemap.addSpriteLocation("temp10", new Rectangle2D.Float(0f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp20", new Rectangle2D.Float(.18f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp30", new Rectangle2D.Float(.36f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp40", new Rectangle2D.Float(.54f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp50", new Rectangle2D.Float(0f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp60", new Rectangle2D.Float(.18f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp70", new Rectangle2D.Float(.36f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp80", new Rectangle2D.Float(.54f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp90", new Rectangle2D.Float(0f, .576f, .18f, .28f)); menumap = new TextureMapper(); menumap.initSheet(this.getClass().getResource("/junkimages/menu_spritesheet_1_12_2014.png"), "PNG"); menumap.addSpriteLocation("levelcomplete", new Rectangle2D.Float(0f, 0f, .5f, .15f)); menumap.addSpriteLocation("darken", new Rectangle2D.Float(0f, .2f, .1f, .1f)); menumap.addSpriteLocation("paused", new Rectangle2D.Float(0f, .44f, .39f, .27f)); menumap.addSpriteLocation("pressspacedark", new Rectangle2D.Float(0f, .715f, .35f, .0618f)); menumap.addSpriteLocation("pressspacelight", new Rectangle2D.Float(0f, .78f, .35f, .0601f)); menumap.addSpriteLocation("optionsdark", new Rectangle2D.Float(0f, .84f, .17f, .12f)); menumap.addSpriteLocation("optionslight", new Rectangle2D.Float(0.17f, 0.84f, .17f, .12f)); menumap.addSpriteLocation("quitlight", new Rectangle2D.Float(0.64f, .695f, .09f, .13f)); menumap.addSpriteLocation("quitdark", new Rectangle2D.Float(0.5f, 0f, .09f, .13f)); menumap.addSpriteLocation("d", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("r", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("drip", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("i", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("p", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); leveleditormap = new TextureMapper(); leveleditormap.initSheet(this.getClass().getResource("/junkimages/leveleditor_spritesheet_22_11_2014.png"), "PNG"); leveleditormap.addSpriteLocation("bottombar", new Rectangle2D.Float(0f, 0f, .78f, .195f)); leveleditormap.addSpriteLocation("sidebar", new Rectangle2D.Float(0f, .195f, .195f, .78f)); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:kuake2.render.lwjgl.Image.java
License:Open Source License
void GL_TextureMode(String string) { int i;/*w ww .j av a2 s. c o m*/ for (i = 0; i < NUM_GL_MODES; i++) { if (modes[i].name.equalsIgnoreCase(string)) break; } if (i == NUM_GL_MODES) { VID.Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); return; } gl_filter_min = modes[i].minimize; gl_filter_max = modes[i].maximize; image_t glt; // change all the existing mipmap texture objects for (i = 0; i < numgltextures; i++) { glt = gltextures[i]; if (glt.type != it_pic && glt.type != it_sky) { GL_Bind(glt.texnum); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max); } } }
From source file:main.java.com.YeAJG.game.io.FileIOHandler.java
License:Open Source License
public static int loadPNGTexture(String filename, int textureUnit) throws IOException { ByteBuffer buf = null;//from w w w . jav a 2s . c o m int tWidth = 0; int tHeight = 0; try { // Open the PNG file as an InputStream InputStream in = new FileInputStream(filename); // Link the PNG decoder to this stream PNGDecoder decoder = new PNGDecoder(in); // Get the width and height of the texture tWidth = decoder.getWidth(); tHeight = decoder.getHeight(); // Decode the PNG file in a ByteBuffer buf = ByteBuffer.allocateDirect(4 * decoder.getWidth() * decoder.getHeight()); decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.RGBA); buf.flip(); in.close(); } catch (IOException e) { throw new IOException(e.getMessage()); } // Create a new texture object in memory and bind it int texId = GL11.glGenTextures(); GL13.glActiveTexture(textureUnit); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId); // All RGB bytes are aligned to each other and each component is 1 byte GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); // Upload the texture data and generate mip maps (for scaling) GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, tWidth, tHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); // Setup the ST coordinate system 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); // Setup what to do when the texture has to be scaled 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); Game.exitOnGLError("loadPNGTexture"); return texId; }
From source file:map.GameMap.java
License:Open Source License
private void renderMinimap() { int size = MINIMAP_SIZE; Texture tex = new Texture("ground"); miniMap = new Material(name + "_minimap"); int[] viewport = GLUtils.getViewport(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/*w w w . j a v a2 s . co m*/ GL11.glOrtho(0, size, size, 0, -10, 10); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glViewport(0, 0, size, size); GL11.glClearColor(0.0f, 0, 0, 1.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glScalef(size / tiles.length, size / tiles.length, size / tiles.length); GLUtils.glLightPos(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); draw(null); GL11.glEnable(GL11.GL_CULL_FACE); IntBuffer addr = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(addr); tex.setID(addr.get(0)); GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); 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); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, size, size, 0); miniMap.setTexture(0, tex); GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); }
From source file:me.thehutch.fusion.engine.render.opengl.gl20.OpenGL20Texture.java
License:Open Source License
@Override public void setWrapMode(WrapMode wrapS, WrapMode wrapT) { ensureCreated("Texture must be created to set wrap mode."); // Set the texture wrap parameters GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS.getGLConstant()); GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT.getGLConstant()); }
From source file:me.thehutch.fusion.engine.render.opengl.gl20.OpenGL20Texture.java
License:Open Source License
@Override public void setFiltering(FilterMode minFilter, FilterMode magFilter) { ensureCreated("Texture must be created to set filtering."); // Set the texture filter parameters GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter.getGLConstant()); GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter.getGLConstant()); }
From source file:me.thehutch.fusion.engine.render.opengl.gl20.OpenGL20Texture.java
License:Open Source License
@Override public void setCompareFunc(CompareFunc compareFunc) { ensureCreated("Texture must be created to set the compare function."); // Set the texture compare function GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, compareFunc.getGLConstant()); GL11.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); }
From source file:me.ukl.api.util.TextureUtil.java
License:MIT License
public static void loadTextureMipmap(int tex, int[] rgb, int width, int height) { IntBuffer rgbBuf = BufferUtils.createIntBuffer(rgb.length); rgbBuf.put(rgb);//from w w w . j a va2 s. c o m rgbBuf.flip(); bind(tex); //If OpenGL30, use glGenerateMipmap, else use the GL_GENERATE_MIPMAP tex param if (RenderUtil.GL_30) { GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, rgbBuf); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); } else { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, rgbBuf); } }