PDA

View Full Version : WorldWindowGLJPanel and CompassLayer problems?


Unregistered
05-27-2007, 07:35 AM
Hello,

I recently downloaded the WW SDK only to hit a couple of snags. I'm not sure if it's WW, JOGL, or even my reference system. So if anyone has run into the same snags or a work-around; it would be appreciated.

Here's what I'm running:

MacOSX (Intel) 10.4.9
Java 1.5.0_07
JOGL (Stable) 1.1.0

As a note I haven't tried running on Solaris, Windows, or Linux.

Here's the code:

import gov.nasa.worldwind.AVKey;
import gov.nasa.worldwind.Layer;
import gov.nasa.worldwind.LayerList;
import gov.nasa.worldwind.Model;
import gov.nasa.worldwind.WorldWind;
import gov.nasa.worldwind.awt.WorldWindowGLCanv as;
import gov.nasa.worldwind.awt.WorldWindowGLJPan el;
import gov.nasa.worldwind.layers.CompassLayer;
import gov.nasa.worldwind.layers.Earth.BMNGSurf aceLayer;
import gov.nasa.worldwind.layers.Earth.EarthNAS APlaceNameLayer;
import gov.nasa.worldwind.layers.Earth.LandsatI 3;
import gov.nasa.worldwind.layers.Earth.USGSUrba nAreaOrtho;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class wwtest {
// private WorldWindowGLJPanel wwp = new WorldWindowGLJPanel(); //1
private WorldWindowGLCanvas wwp = new WorldWindowGLCanvas();

public void ww() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_O N_CLOSE);
f.add(wwp, BorderLayout.CENTER);

Model m = (Model) WorldWind.createConfigurationComponent(A VKey.MODEL_CLASS_NAME);

m.setLayers(new LayerList(new Layer[] {
new BMNGSurfaceLayer(),
new LandsatI3(),
new USGSUrbanAreaOrtho(),
new EarthNASAPlaceNameLayer(),
new CompassLayer("Compass.png")})); //2

wwp.setModel(m);
f.setVisible(true);
}

public static void main(String[] args) {
final wwtest wwt = new wwtest();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
wwt.ww();
}
});
}
}

Snag 1 (see comment //1):

If I switch to a WorldWindGLJPanel the following exception is thrown:

Exception in thread "main" gov.nasa.worldwind.WWRuntimeException: Unable to create WorldWindow
at gov.nasa.worldwind.awt.WorldWindowGLJPan el.<init>(WorldWindowGLJPanel.java:34)
at wwtest.<init>(wwtest.java:21)
at wwtest.main(wwtest.java:43)
Caused by: java.lang.NullPointerException
at javax.media.opengl.GLJPanel.setAutoSwapB ufferMode(GLJPanel.java:791)
at gov.nasa.worldwind.WorldWindowGLAutoDraw able.<init>(WorldWindowGLAutoDrawable.java:43)
at gov.nasa.worldwind.awt.WorldWindowGLJPan el.<init>(WorldWindowGLJPanel.java:26)
... 2 more

FYI: I was able to bypass the exception; however, this exception is thrown in the official SDK release of WW (no code changes).

Snag 2 (see comment //2):

If I use the non-default constructor for CompassLayer, and pass in another PNG image the WW canvas begins to flicker when the mouse is moved into the component. Also, I should mention the PNG image is loaded; however, it's visibly scaled smaller than it's actual pixel size.


Anyway, if anyone as an idea as to what's causing the problems or any other ideas; then drop a reply thread.

Thanks,
jeremy

patmurris
05-27-2007, 06:39 PM
I'm not sure which version of JOGL the SDK is using but JOGL 1.1 seems a bit old... is it a version you installed some time ago, before the SDK ?

About the Compass size, the Compass layer has two properties that you may want to set : setCompassToViewportScale(double compassToViewportScale) and setIconScale(double iconScale).

Unregistered
05-28-2007, 01:25 AM
Hello,

I don't think JOGL 1.1.0 is that old; according to the JOGL website (https://jogl.dev.java.net/) that version was released stable in late April 07, and I only just downloaded it recently (within the last couple of days).

I could try using the latest JOGL 1.1.1-pre, but unless there's a good technical reason or bug correction I'd like to stick with the stable release.

I'll try the compass sizing props as mentioned; however, that seems like it will only address the scaling issue, not the flickering of the Canvas.

Do you have any ideas as to why the WWGLJPanel throws an error?

In case anyone is wondering... here's what the WW Diagnostic program reports:

NASA World Wind Early Access 2 0.2.0

System Properties
Processors: 2
Free memory: 526164080 bytes
Max memory: 532742144 bytes
Total memory: 532742144 bytes
com.apple.mrj.application.apple.menu.abo ut.name = World Wind Diagnostic Program
sun.java2d.noddraw = true
javaplugin.proxy.config.type = direct
apple.laf.useScreenMenuBar = true
user.timezone = America/Phoenix
com.apple.mrj.application.growbox.intrud es = false
jnlpx.remove = false

OpenGL Values
OpenGL version: 2.0 ATI-1.4.52
stencil bits: 0
depth bits: 24
max texture units: 8
max texture image units: 16
max texture coords: 8
max texture size: 4096
max elements indices: 150000
max elements vertices: 2048
max lights: 8
Extensions
GL_ARB_transpose_matrix
GL_ARB_vertex_program
GL_ARB_vertex_blend
GL_ARB_window_pos
GL_ARB_shader_objects
GL_ARB_vertex_shader
GL_EXT_multi_draw_arrays
GL_EXT_clip_volume_hint
GL_EXT_rescale_normal
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_gpu_program_parameters
GL_APPLE_client_storage
GL_APPLE_specular_vector
GL_APPLE_transform_hint
GL_APPLE_packed_pixels
GL_APPLE_fence
GL_APPLE_vertex_array_object
GL_APPLE_vertex_program_evaluators
GL_APPLE_element_array
GL_APPLE_flush_render
GL_NV_texgen_reflection
GL_NV_light_max_exponent
GL_IBM_rasterpos_clip
GL_SGIS_generate_mipmap
GL_ARB_shading_language_100
GL_ARB_imaging
GL_ARB_point_parameters
GL_ARB_texture_env_crossbar
GL_ARB_texture_border_clamp
GL_ARB_multitexture
GL_ARB_texture_env_add
GL_ARB_texture_cube_map
GL_ARB_texture_env_dot3
GL_ARB_multisample
GL_ARB_texture_env_combine
GL_ARB_texture_compression
GL_ARB_texture_mirrored_repeat
GL_ARB_shadow
GL_ARB_depth_texture
GL_ARB_shadow_ambient
GL_ARB_fragment_program
GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader
GL_ARB_occlusion_query
GL_ARB_point_sprite
GL_ARB_texture_non_power_of_two
GL_ARB_vertex_buffer_object
GL_ARB_pixel_buffer_object
GL_ARB_draw_buffers
GL_ARB_shader_texture_lod
GL_EXT_compiled_vertex_array
GL_EXT_framebuffer_object
GL_EXT_texture_rectangle
GL_ARB_texture_rectangle
GL_EXT_texture_env_add
GL_EXT_blend_color
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_texture_lod_bias
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_stencil_wrap
GL_EXT_texture_filter_anisotropic
GL_EXT_separate_specular_color
GL_EXT_secondary_color
GL_EXT_blend_func_separate
GL_EXT_shadow_funcs
GL_EXT_stencil_two_side
GL_EXT_texture_compression_s3tc
GL_EXT_texture_compression_dxt1
GL_EXT_blend_equation_separate
GL_EXT_texture_mirror_clamp
GL_EXT_packed_depth_stencil
GL_APPLE_flush_buffer_range
GL_APPLE_ycbcr_422
GL_APPLE_vertex_array_range
GL_APPLE_texture_range
GL_APPLE_float_pixels
GL_ATI_texture_float
GL_ARB_texture_float
GL_APPLE_pixel_buffer
GL_NV_blend_square
GL_NV_fog_distance
GL_ATI_texture_mirror_once
GL_ATI_text_fragment_shader
GL_ATI_blend_equation_separate
GL_ATI_blend_weighted_minmax
GL_ATI_texture_env_combine3
GL_ATI_separate_stencil
GL_ATI_texture_compression_3dc
GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod
GL_SGI_color_matrix

JOGL Values
package javax.media.opengl, Java Bindings for OpenGL API Specification, version 1.1.1-rc2
Specification Title = Java Bindings for OpenGL API Specification
Specification Vendor = Sun Microsystems, Inc.
Specification Version = 1.1.1-rc2
Implementation Vendor = Sun Microsystems, Inc.
Implementation Version = 1.1.1-rc2


Hmm... that's interesting... JOGL 1.1.1-rc2. Anyway, anyone else have any ideas?

tag
06-02-2007, 03:58 PM
GLJPanel doesn't work. Don't even try. There are still several issues with using JOGL in a JPanel cross-platform. We're working with Sun on them.

Unregistered
06-04-2007, 06:03 PM
Thank you for the reply Tag because I started to worry that I was the only one that hit the LW WWJPanel problem (and it doesn't take much to replicate the error)....

By chance, do you have any ideas with the PNG image problem?