/* GLUtil.java * * Copyright (c) 2003, : Tuomas J. Lukka * * This file is part of Gzz. * * Gzz is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Gzz is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Gzz; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * */ /* * Written by : Tuomas J. Lukka */ package org.nongnu.libvob.gl; /** Miscellaneous GL utilities that don't belong. */ public class GLUtil { public static boolean dbg = false; final static void pa(String s) { System.out.println(s); } /** Delete the texture and recopy the compressed * levels start..end-1 to it,. * It appears that there's a small driver bug in NVIDIA's * driver (or that I'm mistaken again ;), where we can't * easily unload texture levels. * This method takes the drastic approach: delete the * texture and then teximage it again. *
* The texture parameters are not touched, except that * BASE_LEVEL and . *
* This MIGHT have now gotten fixed with the realization that
* we should always keep so many levels of the texture
* that both width and height are greater than 1 - not sure though.
*/
static public void reloadCompressed(GL.Texture tex, int start, int end) {
if(dbg) pa("Reload "+tex+" "+start+" "+end);
String texformat = null;
int[] sizes = new int[end*2];
byte[][] backup = new byte[end][];
if(dbg) pa("ch: "+checkMipmap(tex));
for(int i=start; i