Hello,
i got a problem with my textures, their color is completly different from the original.
This is my code to load a texture:
public static int loadTexture2(String s) throws IOException{
BufferedImage image;
image = ImageIO.read(new File("./data/grass.jpg"));
//
int width = image.getWidth();
int height = image.getHeight();
DataBufferByte rawData = (DataBufferByte) image.getData().getDataBuffer();
ByteBuffer data = BufferUtils.createByteBuffer(rawData.getSize());
data.put(rawData.getData());
data.rewind();
IntBuffer scratch = BufferUtils.createIntBuffer(1);
GL11.glGenTextures(scratch);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, scratch.get(0));
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_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data);
return scratch.get(0);
}
for example i have yellow yellow square as texture it goes blue..
Can anyone tell me what i'm doing wrong?
Thanks in advance