World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 07-31-2012, 06:27 PM   #1
sarahjor
Junior Member
 
Join Date: Jul 2012
Location: New York
Posts: 7
sarahjor is on a distinguished road
Default Screenshot does not seem to work with WorldWindowGLJPanel

I had to change from WorldWindowGLCanvas to WorldWindowGLJPanel due to multiple reasons, but now when I take a screenshot there is a black box above the image.

Code:
   private class ScreenshotRunnable implements Runnable, IBufferedImageProvider
    {      
            BufferedImage myImage = null;
            int width;
            int height;
            
            @Override
            public void run()
            {
                // create a screenshot image of the WorldWind context
            GLContext context = WORLD_WINDOW.getContext();
            width = context.getGLDrawable().getWidth();
            height = context.getGLDrawable().getHeight();
                
                if (width > 0 && height > 0)
                {
                context.makeCurrent();
                myImage = com.sun.opengl.util.Screenshot.readToBufferedImage(width, height);
                context.release();
                }
            }
            
            @Override
            public BufferedImage getBufferedImage() throws ReportException
            {
                return myImage;
            }
sarahjor is offline   Reply With Quote
Old 08-01-2012, 03:04 PM   #2
sarahjor
Junior Member
 
Join Date: Jul 2012
Location: New York
Posts: 7
sarahjor is on a distinguished road
Default

Nevermind, I figured it out on my own!! I followed advice from this site:

http://issues.worldwind.arc.nasa.gov...browse/WWJ-275

Turns out I needed to use View to get the height and width, rather than GLContext.
sarahjor is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to put WorldWindowGLJPanel in JPanel tmkd WorldWind General 1 12-08-2010 06:11 PM
Centering the globe in a WorldWindowGLJPanel nigel25840 Development Help 1 01-13-2009 09:24 PM
WorldWindowGLJPanel and GlobeAnnotation shawngano Development Help 2 12-15-2007 07:42 PM
About WorldWindowGLJPanel asantiago Development Help 6 11-06-2007 06:55 PM
WW refuses to work correctly ups Technical Support 19 10-22-2004 04:57 AM


All times are GMT +1. The time now is 11:21 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.