Júlio
asked on
C++ to Delphi
Hi,
Could you please convert to delphi:
Ty!
Could you please convert to delphi:
public static BufferedImage glScreenshot() {
glReadBuffer(GL_FRONT);
int w = Display.getDisplayMode().getWidth();
int h = Display.getDisplayMode().getHeight();
int bpp = 4;
ByteBuffer buffer = BufferUtils.createByteBuffer(w * h * bpp);
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
int i = (x + (w * y)) * bpp;
int r = buffer.get(i) & 0xFF;
int g = buffer.get(i + 1) & 0xFF;
int b = buffer.get(i + 2) & 0xFF;
image.setRGB(x, h - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b);
}
}
return image;
}
Ty!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER