Talk About Network

Google





Graphics > OpenGL 3D API > Re: How do I ti...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 7 Topic 4772 of 5061
Post > Topic >>

Re: How do I tile a sphere ?

by "jbwest" <jbwest@[EMAIL PROTECTED] > Jun 1, 2008 at 06:24 PM

"Lynton Towler" <lynton@[EMAIL PROTECTED]
> wrote in message 
news:g1u4o1$e1o$1$8300dec7@[EMAIL PROTECTED]
> Hello,
>    Thanks for reading.
> In the past I have received help from you guys on this NG and am hoping 
> once again you could be so kind.
> I've been working on a 3D Earth type program using OpenGL with GLUT.
> Currently I load a rather large single texture of the earth and cover
the 
> sphere with it, this works OK but is a bit slow at loading.
> I think I need to convert to a tiles approach where I divide the sphere 
> into say 512x512 tiles then texture each tile individually to speed
things 
> up a little and make future zooming in easier.
> I could then of course load/cache each tile on demand when its within 
> view.
> These ideas are nothing new I know but I could really do with a small 
> skeleton tutorial or whatever on how to do this so if you know of one
I'd 
> really appreciate it.
> I have Googled around a bit and found stuff talking of "Quad Tiles" etc 
> but no decent example code.
>
> Thanks in advance
>
> Lynton, England UK
>
> -- 
>

You have one big texture now, and it works, right ?
So, what if you split the big texture into 2 pieces, with a 1 row (or 
column) pixel overlap?
 Then, what would you do to the texture coordinates for your sphere?
How about multiply by 2 in that direction, so that 1/2 the way around, you

are at the edge of
texture #1. Then, by extension, the 2nd half of the sphere & second
texture 
is easy, right ? Just start over from [0+****ft to 1-****ft]. on the next 
texture.

See whay you need to overlap ?. The last/first texure coordinate has to be

1/(2*texture size) ****fted, so that the
"seam" is exactly aligned in the center of the 1st/last texel. You already

did this anyway, right ?

OK, by extension, subdivide in the other direction. If that works', now
you 
are home free.
For each of the 4 patches, apply the same alorithm again...& etc.


For extra credit, now what you want to do is start with the big texture
and 
sphere #1.
As you zoom in, at some point go to the next level of detail on the
textures 
*and* increase the
sphere sampling density.  So, when you are zoomed out, you don't have to 
load 4/16/64 or whatever textures.
In fact, you don't need a hugely big initial texture. You don't need one
any 
bigger than twice the screen resolution., if
you cutoff point is the sphere filling the view****t. You can adjust your 
level-of-detail so that the textures are "perfect" given the screen 
resolution at that zoom level...


-jbw
 




 7 Posts in Topic:
How do I tile a sphere ?
"Lynton Towler"  2008-06-01 13:29:38 
Re: How do I tile a sphere ?
"jbwest" <jb  2008-06-01 18:24:39 
Re: How do I tile a sphere ?
fungus <openglMYSOCKS@  2008-06-02 05:07:29 
Re: How do I tile a sphere ?
"jbwest" <jb  2008-06-02 19:17:46 
Re: How do I tile a sphere ?
"Lynton Towler"  2008-06-03 18:42:33 
Re: How do I tile a sphere ?
Chris Forone <4one@[EM  2008-06-04 07:48:29 
Re: How do I tile a sphere ?
"Lynton Towler"  2008-06-07 08:29:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 16:44:52 PST 2009.