it seems my texture loader doesnt work anymore when run in a 64bit environment. im not sure if the cause is the 64bit VM itself or if the file lying on a 64bit filesystem.
the image to load is a RGBA png file, it shows up correctly on 32bit windows systems, but on my 64bit win7 some color channels seem flipped.
here is my code:
InputStream is = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(path);
BufferedImage bi = ImageIO.read(is);
is.close();
byte[] databytes = ((DataBufferB开发者_Go百科yte) bi.getRaster().getDataBuffer()).getData();
ByteBuffer data = ByteBuffer.allocateDirect(databytes.length);
data.order(ByteOrder.nativeOrder());
data.put(databytes, 0, databytes.length);
data.rewind();
IntBuffer texb = IntBuffer.allocate(1);
binding.genTextures(1, texb);
binding.bindTexture(binding.TEXTURE_2D(), texb.get(0));
binding.texParameter(binding.TEXTURE_2D(), binding.TEXTURE_MIN_FILTER(),
binding.LINEAR());
binding.texParameter(binding.TEXTURE_2D(), binding.TEXTURE_MAG_FILTER(),
binding.LINEAR());
binding.texParameter(binding.TEXTURE_2D(), binding.TEXTURE_WRAP_S(),
binding.CLAMP());
binding.texParameter(binding.TEXTURE_2D(), binding.TEXTURE_WRAP_T(),
binding.CLAMP());
binding.texEnvi(binding.TEXTURE_ENV(), binding.TEXTURE_ENV_MODE(),
binding.MODULATE());
binding.texImage2D(binding.TEXTURE_2D(), 0, binding.RGBA(), bi.getWidth(),
bi.getHeight(), 0, binding.RGBA(), binding.UNSIGNED_BYTE(), data);
does anyone know what could be wrong? thanks!
actually it turned out a problem with the latest update java6 u18 which contained some changes to bufferedimage and had nothing to do with 64bit VMs
精彩评论