Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
But go ahead and try the problem yourself, though.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
15 posts
|
Ok, as now I research I saw that the best way use Direct capture, I also may be to try jogl, but with my low experiace I can't do it quick.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
15 posts
|
Hi, Pixelapp, what about jogl screen code, you tell me to remember you.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
Ok, I get it.
If I get anything working I'll be sure to post it here. Ok. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
This post was updated on Sep 13, 2012; 2:42pm.
In reply to this post by Andriy
Ok Andriy, here is the code:
try { BufferedImage tScreenshot = Screenshot.readToBufferedImage(0,0, 600, 600, false); File tScreenCaptureImageFile = new File("src/yourpa/ckage/hello.png"); ImageIO.write(tScreenshot, "png", tScreenCaptureImageFile); } catch (IOException ioe) { System.out.println (ioe.getMessage ()); } To avoid the error you get, I suggest you put this code at the end of the display() method. And since you will be using the animator, lower the frame rate to 1 frame per second otherwise it will crash during this test. Moreover, judging by the fact that this class was developed by Jogampers I expect it to be of high quality and a really fast class. Therefore I'm sticking to this class to develop my project much further. |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
3 posts
|
Hi, Pixelapp, I am new in jogl and opengl conception at all, may be it simple question but I need simple code of main class include animator also, witch create work screen of desktop, I it isn't difficult write for me this code please. I need first to test this to think really it for me.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
The code is written already:
https://sites.google.com/site/justinscsstuff/jogl-tutorial-1 https://sites.google.com/site/justinscsstuff/jogl-tutorial-2 https://sites.google.com/site/justinscsstuff/jogl-tutorial-3 Let me know if you need anythinng else. |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
3 posts
|
I saw this codes early and do thomething of those examples, but I cann't understand how to create desktop screenshot, as I now know to create screenshot I need gdrawable context, how I get a desktop context, how to put all desktop to canvas???You try to create screenshot of desktop???If try please show me your code, I want to see it. Now I don't see only the way to use jna and system api for my problem.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
This code tells you exactly what you are asking.
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
3 posts
|
Good, this is code:
package test; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.awt.Screenshot; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class JOGLCapture implements GLEventListener { private double theta = 0; private double s = 0; private double c = 0; public static void main(String[] args) { GLProfile glp = GLProfile.getDefault(); GLCapabilities caps = new GLCapabilities(glp); GLCanvas canvas = new GLCanvas(caps); Frame frame = new Frame("AWT Window Test"); frame.setSize(300, 300); frame.add(canvas); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); canvas.addGLEventListener(new JOGLCapture()); FPSAnimator animator = new FPSAnimator(canvas, 60); animator.add(canvas); animator.start(); } @Override public void display(GLAutoDrawable drawable) { update(); render(drawable); try { BufferedImage tScreenshot = Screenshot.readToBufferedImage(0,0, 600, 600, false); File tScreenCaptureImageFile = new File("/home/android/hello.png"); ImageIO.write(tScreenshot, "png", tScreenCaptureImageFile); System.exit(0); } catch (IOException ioe) { System.out.println (ioe.getMessage ()); } } @Override public void dispose(GLAutoDrawable drawable) { } @Override public void init(GLAutoDrawable drawable) { } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { } private void update() { theta += 0.01; s = Math.sin(theta); c = Math.cos(theta); } private void render(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); // draw a triangle filling the window gl.glBegin(GL.GL_TRIANGLES); gl.glColor3f(1, 0, 0); gl.glVertex2d(-c, -c); gl.glColor3f(0, 1, 0); gl.glVertex2d(0, c); gl.glColor3f(0, 0, 1); gl.glVertex2d(s, -s); gl.glEnd(); } } I have only a screen of java frame, and what about all desktop screenshot?? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
Delete this "System.exit(0);"
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
15 posts
|
And how it help me????Delete but work screen of display don't get.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
So, what's your problem again?
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6045 posts
|
In reply to this post by Andriy
What are you trying to achieve? You can only get a screenshot of the current content of a canvas, not the whole desktop.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
15 posts
|
I know this, but I want to know can jogl get a screenshot of desktop?If it can, how ???
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
196 posts
|
"What are you trying to achieve? You can only get a screenshot of the current content of a canvas, not the whole desktop."
I second that. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6045 posts
|
In reply to this post by Andriy
Maybe you can do that with a maximized transparent window.
You can use Screencast-O-Matic or Have2Chat Screencast, the latter is entirely written in Java, its author is a nice guy, you should contact him if you need some help. Good luck.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |