Closed DotNaos closed 1 year ago
public int getPixel(int x, int y) {
int[] pixels = new int[width * height];
glBindTexture(GL_TEXTURE_2D, texID);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glBindTexture(GL_TEXTURE_2D, 0);
return pixels[x + y * width];
}
Only Spritesheets with the same amount of columns are supported