Solved

C++ to Delphi

Posted on 2013-11-06
2
483 Views
Last Modified: 2013-11-07
Hi,

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;
}

Open in new window


Ty!
0
Comment
Question by:Júlio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 39628222
This might not help much, but: That's not valid C++ code. "public static" wouldn't compile.
0
 

Author Comment

by:Júlio
ID: 39630251
ok ty!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question