开发者

Screen Capture of DirectX programs with Java

I wrote a Java application that uses the java.awt.Robot to take screen captures of the screen and was wondering if capturing a program using DirectX/OpenGL would be possible?

Each time开发者_运维技巧 I try to do this, I get a black screen


Don't know if this is really a solution but seems there's more possible ways to get the screenshot information using a "FrameGrabber" or some related class from JavaCV possibly: http://code.google.com/p/javacv/ Some of the final output shown on the screen could be calculated on a graphics card that has shaders set to act on the image data before it gets put into a display buffer for what's shown so it's possible some effects would be impossible to capture without an analog loopback (go from video out to video in on a capture card).

Related post How to take screenshots fast in Java?


OpenGL is a drawing API, not an all purpose interface to the graphics system. There were times, when taking screenshots with OpenGL was indeed possible through some dirty hacks. However recently I tried to re-implement this on modern OS to see if it still works, and no, it doesn't anymore.


Yes it is possible. But maybe only in limited circiumstances.

I've successfully captured the contents on OpenGL (jogl) windows on linux and windows using the Robot createScreenCapture.

Some specific information about the implementation that may be different for you:

  • The call to createScreenCapture was done from within the OpenGL application.
  • The application used heavyweight GLCanvas
  • It used Java 6

Make sure you pass it the correct coordinates. You can get the screen coordinates to use from the GraphicsEnvironment


Uhh... a hard one ;o)

I had a try with some other screenshot utils and got a black screen, too. Looks like DirectX is passing the graphics directly to the monitor output. I am wondering if that could be accessed within a java application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜