Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Sphere texture mapping - distortion strip problem

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 Sword7   Members   

135
Like
0Likes
Like

Posted 23 April 2013 - 08:39 PM

Hello folks,

 

I am writing a small program to display planet earth by using glDrawElements and vertex/indices array.

 

It normally displays planet earth but seam strip between alaska and russia land.  I think that it is a problem with texcoords or glDrawElements function call.  I tried different ways but it always display distrotion strip.  Does anyone know any working around to get rid of distrotion strip?

Look at my code below.

 

Thanks!

Sword7

 

    int    thetaExtent = extent;

    int    phiExtent   = extent/2;

    int    theta1      = theta0 + thetaExtent;

    int    phi1        = phi0 + phiExtent;

    double phiStep     = (PI) / phiExtent;

    double thetaStep   = (2 * PI) / thetaExtent;

 
    double *v = vertices;

    double *t = texCoords;
    for (int phi = phi0; phi <= phi1; phi += ri.step) {

        for (int theta = theta0; theta < theta1; theta += ri.step) {

            *v++ = sin(phi * phiStep) * cos(theta * thetaStep);

            *v++ = cos(phi * phiStep);

            *v++ = sin(phi * phiStep) * sin(theta * thetaStep);



            *t++ = 1 - (theta * (1.0 / thetaExtent));

            *t++ = phi * (1.0 / phiExtent);

        }

    }



    uint16 *i = indices;

    for (int p = 0; p < phiExtent; p++) {

        for (int t = 0; t < thetaExtent; t++) {

            *i++ = p * thetaExtent + t;

            *i++ = p * thetaExtent + (t+1);

            *i++ = (p+1) * thetaExtent + (t+1);

            *i++ = (p+1) * thetaExtent + t;

        }

    }

 
    glVertexPointer(3, GL_DOUBLE, 0, vertices);

    glNormalPointer(GL_DOUBLE, 0, vertices);

    glTexCoordPointer(2, GL_DOUBLE, 0, texCoords);



    glDrawElements(GL_QUADS, nIndices, GL_UNSIGNED_SHORT, indices);





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.