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
Solved

C++ to Delphi

Posted on 2013-11-06
2
480 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

809 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