Note that there are some explanatory texts on larger screens.

plurals
  1. POUV mapping for a dome?
    text
    copied!<p>I am trying to understand how can I change UV mapping of a dome, I need a different texture map projection than this one coded below:</p> <pre><code> protected final void createDome(final float radius) { int lats=16; int longs=16; GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textures2x4[0].getTextureID()); int i, j; int halfLats = lats / 2; for(i = 0; i &lt;= halfLats; i++) { double lat0 = MathUtils.PI * (-0.5 + (double) (i - 1) / lats); double z0 = Math.sin(lat0)* radius; double zr0 = Math.cos(lat0)* radius; double lat1 = MathUtils.PI * (-0.5 + (double) i / lats); double z1 = Math.sin(lat1)* radius; double zr1 = Math.cos(lat1)* radius; GL11.glBegin(GL11.GL_QUAD_STRIP); for(j = 0; j &lt;= longs; j++) { double lng = 2 * MathUtils.PI * (double) (j - 1) / longs; double x = Math.cos(lng); double y = Math.sin(lng); double s1, s2, t; s1 = ((double) i) / halfLats; s2 = ((double) i + 1) / halfLats; t = ((double) j) / longs; // HERE: I don't know how to calculate the UV mapping GL11.glTexCoord2d(s1, t); GL11.glNormal3d(x * zr0, y * zr0, z0); GL11.glVertex3d(x * zr0, y * zr0, z0); GL11.glTexCoord2d(s2, t); GL11.glNormal3d(x * zr1, y * zr1, z1); GL11.glVertex3d(x * zr1, y * zr1, z1); } GL11.glEnd(); } } </code></pre> <p>I linked the output image and the original map. Pratically I need a UV mapping which places the Artic at the zenith/top of the dome, and the Antartic streched on the bottom side of the dome... the Artic/Antartic map is only used to figure out what I mean, my need it's not to fit a globe emisphere</p> <p><a href="http://img831.imageshack.us/img831/3481/lwjgl.png" rel="nofollow noreferrer">Output image http://img831.imageshack.us/img831/3481/lwjgl.png</a></p> <p><a href="http://img203.imageshack.us/img203/4930/earthc.png" rel="nofollow noreferrer">Source map http://img203.imageshack.us/img203/4930/earthc.png</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload