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 04-20-2009, 10:02 PM   #1
nigel_ht
Senior Member
 
Join Date: Aug 2005
Posts: 337
nigel_ht
Default Coloring polygon intersections

How would I have the intersections of polygons appear in a different colors? For example color where two polygons overlap yellow and where three red?

Is working with a custom GLU tessellCallBack and override combine method the customary way in JOGL?

How might I do this with WWJ shapes?
nigel_ht is offline   Reply With Quote
Old 04-20-2009, 10:27 PM   #2
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

If you are referring to surface shapes, you may use some transparency so that the intersection will show through. Is it about air space shapes?
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 04-21-2009, 12:40 PM   #3
nigel_ht
Senior Member
 
Join Date: Aug 2005
Posts: 337
nigel_ht
Default

Yes, I use the alpha now for that so two intersecting yellow circles just get more yellow. What I'd like is for them to become red in the intersections.
nigel_ht is offline   Reply With Quote
Old 04-21-2009, 02:40 PM   #4
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

I don't think there is any easy way to do that. What you could do is compute the two shapes intersection and overlay a third shape over the intersection with a different color.
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 05-06-2009, 06:58 PM   #5
dcollins
WWJ Dev. Team
 
Join Date: May 2007
Posts: 449
dcollins is on a distinguished road
Default

Hi Nigel, as Patrick says, there's no easy way to do that with the WWJ surface shapes. I can think of two approaches to solving this:

1. Patrick's suggestion of computing the intersection and drawing a new shapes. If you can compute the intersection in app code, this is a straightforward solution.

2. Override the surface shape rendering code add add this behavior. I would use the stencil buffer to distinguish which pixels contain intersecting shapes. Then simply draw your desired intersection color wherever the stencil values are greater than your desired number of intersections.

There's no example stencil buffer code in WWJ. For that, refer to
http://www.opengl.org/resources/code...s/node117.html

You'll want to add your functionality by extending the appropriate SurfaceShape, then overriding the method doRenderToRegion(). This method is responsible for rasterizing the shape into each tile (remember, surface shapes are drawn into a tile pyramid now).

Thanks,
Dave
dcollins 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
A method to compute the area of a spherical polygon Jason_Steven Developers' Corner 13 02-13-2012 02:01 AM
How to fill color in a polygon? Jason_Steven Developers' Corner 6 11-26-2008 04:09 AM
How to make a glitter polygon Jason_Steven Developers' Corner 1 11-24-2008 05:22 PM
2d Polygon rnrivas Development Help 4 11-20-2007 08:21 PM
Interesting mathmatical question and polygon extrusion opacity Hactic Developers' Corner 3 09-20-2007 02:11 PM


All times are GMT +1. The time now is 09:33 AM.


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