Results 1 to 10 of 10

Thread: OpenGL Texture Mapping [Equirectangular 2 Azimuthal Equidistant]

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Default

    Yeah a stack overflow is exactly that but there is a site (part of google I believe) called stack overflow where you can get help on coding.

    http://stackoverflow.com/

    But if you do get a table of values printed out then post the table as well and I'll glance my eye at it. There's quite a few good programmers around here as well making maps. someone will be able to see it if not I.

  2. #2

    Default

    Quote Originally Posted by Redrobes View Post
    if you do get a table of values printed out then post the table as well and I'll glance my eye at it. There's quite a few good programmers around here as well making maps. someone will be able to see it if not I.
    I created some tables and analysed them in MATLAB... and i'm glad I did. it led to quite an embarrassing bug in my code:

    * sorry about indenting couldn't get it to work
    for (i=0; i<4; i++) { // FOR THE FOUR VERTICES OF QUAD.

    // disk coordinates
    p_d[n].x = b2[i] * cos(a2[i]) + x0;
    p_d[n].y = b2[i] * sin(a2[i]) + y0;

    // calcuate texture coordinates
    AziCalc (lat_p, long_p, b2[i], a2[i], p_d[n].x, R);
    p_d[n].u = 0.5 - longitude/PI2;
    p_d[n].v = latitude/PI;

    // I HAD THE TEXTURE WRAPPING CODE HERE!

    n++;
    }

    // THE CODE SHOULD HAVE BEEN HERE!
    // Wrap bad texture coordinates
    getmax2(n-4, n-1, &max, &index); //get max value for last quad
    getmin2(n-4, n-1, &min, &index); //get min value for last quad
    while (max - min > 0.5){ // if texture coordinates too far apart
    p_d[index].u += 1; //wrap coordinates
    getmax2(n-4, n-1, &min, &index); //get max value for last quad
    getmin2(n-4, n-1, &min, &index); //get min value for last quad
    }
    }
    The program now works well. Here is the fixed version: Fixed version
    (I compiled this version as 'Release' as this should hopfully get rid of some dll dependencies - not sure though)

    Thank you very much Redrobes, you were very helpfull. I also have been reading some of your thread on bitmaps and am enjoying it

    I have uploaded some of the code here if anyone wants to look. I

    was also wndering if there was a way to add '[SOLVED]' to thread title?
    Last edited by felixrulz; 07-31-2012 at 11:22 PM. Reason: Typo and ink broken

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •