Solved

C++ to Delphi

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now