From: R.M. L. <u8...@cs...> - 2002-03-06 16:55:50
|
Hello, I'm looking at some of the demo code, but i'm not entirely sure how to go from the exert below to loading in and binding the three textures i require in the loadtextures method, do we have to delete the image after we are finished. If there is an easier way to load in 3 textures, could someone please let me know. The loading in part seems to be the most difficult part. Thanks again, Mark. Current code, taken from demo: public void LoadGLTextures() { PngTextureLoader texLoader = new PngTextureLoader(gl,glu); texLoader.readTexture(getCodeBase(), "pic/crate.png");//Load in tex, check name & path.. if(texLoader.isOk()) { //Create nearest filtered texture gl.glGenTextures(3, texture); gl.glBindTexture(GL_TEXTURE_2D, texture[0]); //Takes color and alpha data from texture, helps with lighting gl.glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glu.gluBuild2DMipmaps(GL_TEXTURE_2D, 3, texLoader.getImageWidth(), texLoader.getImageHeight(), GL_RGB, GL_UNSIGNED_BYTE, texLoader.getTexture()); } } |