2013-04-10 83 views
0

我想使用膠水(功能如下)繪製球體,它只支持單個紋理。 我必須在iphone4上使用大質感(8096X4096)。我將大質地分成幾個小塊(512X512)。我怎樣才能使用多紋理結合這些小的是一個很大的傳遞給gluSphere使用?如何使用多紋理作爲一個紋理?

預先感謝您!

//glues draw sphere function 
GLAPI void APIENTRY gluSphere(GLUquadric* qobj, GLfloat radius, GLint slices, GLint stacks) 
      { 
       GLint i, j; 
       GLfloat sinCache1a[CACHE_SIZE]; 
       GLfloat cosCache1a[CACHE_SIZE]; 
       GLfloat sinCache2a[CACHE_SIZE]; 
       GLfloat cosCache2a[CACHE_SIZE]; 
       GLfloat sinCache3a[CACHE_SIZE]; 
       GLfloat cosCache3a[CACHE_SIZE]; 
       GLfloat sinCache1b[CACHE_SIZE]; 
       GLfloat cosCache1b[CACHE_SIZE]; 
       GLfloat sinCache2b[CACHE_SIZE]; 
       GLfloat cosCache2b[CACHE_SIZE]; 
       GLfloat sinCache3b[CACHE_SIZE]; 
       GLfloat cosCache3b[CACHE_SIZE]; 
       GLfloat angle; 
       GLfloat zLow, zHigh; 
       GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0; 
       GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0; 
       GLfloat vertices[(CACHE_SIZE+1)*2][3]; 
       GLfloat texcoords[(CACHE_SIZE+1)*2][2]; 
       GLfloat normals[(CACHE_SIZE+1)*2][3]; 
       GLboolean needCache2, needCache3; 
       GLint start, finish; 
       GLboolean texcoord_enabled; 
       GLboolean normal_enabled; 
       GLboolean vertex_enabled; 
       GLboolean color_enabled; 

       if (slices>=CACHE_SIZE) 
       { 
        slices=CACHE_SIZE-1; 
       } 

       if (stacks>=CACHE_SIZE) 
       { 
        stacks=CACHE_SIZE-1; 
       } 

       if (slices<2 || stacks<1 || radius<0.0) 
       { 
        gluQuadricError(qobj, GLU_INVALID_VALUE); 
        return; 
       } 

       /* Cache is the vertex locations cache */ 
       /* Cache2 is the various normals at the vertices themselves */ 
       /* Cache3 is the various normals for the faces */ 
       needCache2=needCache3=GL_FALSE; 

       if (qobj->normals==GLU_SMOOTH) 
       { 
        needCache2=GL_TRUE; 
       } 

       if (qobj->normals==GLU_FLAT) 
       { 
        if (qobj->drawStyle!=GLU_POINT) 
        { 
        needCache3=GL_TRUE; 
        } 
        if (qobj->drawStyle==GLU_LINE) 
        { 
        needCache2=GL_TRUE; 
        } 
       } 

       for (i=0; i<slices; i++) 
       { 
        angle=2.0f*PI*i/slices; 
        sinCache1a[i]=(GLfloat)sin(angle); 
        cosCache1a[i]=(GLfloat)cos(angle); 
        if (needCache2) 
        { 
        sinCache2a[i] = sinCache1a[i]; 
        cosCache2a[i] = cosCache1a[i]; 
        } 
       } 

       for (j=0; j<=stacks; j++) 
       { 
        angle=PI*j/stacks; 
        if (needCache2) 
        { 
        if (qobj->orientation==GLU_OUTSIDE) 
        { 
         sinCache2b[j]=(GLfloat)sin(angle); 
         cosCache2b[j]=(GLfloat)cos(angle); 
        } 
        else 
        { 
         sinCache2b[j]=(GLfloat)-sin(angle); 
         cosCache2b[j]=(GLfloat)-cos(angle); 
        } 
        } 

        sinCache1b[j]=(GLfloat)(radius*sin(angle)); 
        cosCache1b[j]=(GLfloat)(radius*cos(angle)); 
       } 

       /* Make sure it comes to a point */ 
       sinCache1b[0]=0; 
       sinCache1b[stacks]=0; 

       if (needCache3) 
       { 
        for (i=0; i<slices; i++) 
        { 
        angle=2.0f*PI*(i-0.5f)/slices; 
        sinCache3a[i]=(GLfloat)sin(angle); 
        cosCache3a[i]=(GLfloat)cos(angle); 
        } 
        for (j=0; j<=stacks; j++) 
        { 
        angle=PI*(j-0.5f)/stacks; 
        if (qobj->orientation==GLU_OUTSIDE) 
        { 
         sinCache3b[j]=(GLfloat)sin(angle); 
         cosCache3b[j]=(GLfloat)cos(angle); 
        } 
        else 
        { 
         sinCache3b[j]=(GLfloat)-sin(angle); 
         cosCache3b[j]=(GLfloat)-cos(angle); 
        } 
        } 
       } 

       sinCache1a[slices]=sinCache1a[0]; 
       cosCache1a[slices]=cosCache1a[0]; 
       if (needCache2) 
       { 
        sinCache2a[slices]=sinCache2a[0]; 
        cosCache2a[slices]=cosCache2a[0]; 
       } 
       if (needCache3) 
       { 
        sinCache3a[slices]=sinCache3a[0]; 
        cosCache3a[slices]=cosCache3a[0]; 
       } 

       /* Store status of enabled arrays */ 
       texcoord_enabled=GL_FALSE; //glIsEnabled(GL_TEXTURE_COORD_ARRAY); 
       normal_enabled=GL_FALSE; //glIsEnabled(GL_NORMAL_ARRAY); 
       vertex_enabled=GL_FALSE; //glIsEnabled(GL_VERTEX_ARRAY); 
       color_enabled=GL_FALSE; //glIsEnabled(GL_COLOR_ARRAY); 

       /* Enable arrays */ 
       glEnableClientState(GL_VERTEX_ARRAY); 
       glVertexPointer(3, GL_FLOAT, 0, vertices); 
       if (qobj->textureCoords) 
       { 
        glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
        glTexCoordPointer(2, GL_FLOAT, 0, texcoords); 
       } 
       else 
       { 
        glDisableClientState(GL_TEXTURE_COORD_ARRAY); 
       } 
       if (qobj->normals!=GLU_NONE) 
       { 
        glEnableClientState(GL_NORMAL_ARRAY); 
        glNormalPointer(GL_FLOAT, 0, normals); 
       } 
       else 
       { 
        glDisableClientState(GL_NORMAL_ARRAY); 
       } 
       glDisableClientState(GL_COLOR_ARRAY); 

       switch (qobj->drawStyle) 
       { 
        case GLU_FILL: 
         if (!(qobj->textureCoords)) 
         { 
          start=1; 
          finish=stacks-1; 

          /* Low end first (j == 0 iteration) */ 
          sintemp2=sinCache1b[1]; 
          zHigh=cosCache1b[1]; 

          switch(qobj->normals) 
          { 
          case GLU_FLAT: 
            sintemp3=sinCache3b[1]; 
            costemp3=cosCache3b[1]; 
            normals[0][0]=sinCache3a[0]*sinCache3b[0]; 
            normals[0][1]=cosCache3a[0]*sinCache3b[0]; 
            normals[0][2]=cosCache3b[0]; 
            break; 
          case GLU_SMOOTH: 
            sintemp3=sinCache2b[1]; 
            costemp3=cosCache2b[1]; 
            normals[0][0]=sinCache2a[0]*sinCache2b[0]; 
            normals[0][1]=cosCache2a[0]*sinCache2b[0]; 
            normals[0][2]=cosCache2b[0]; 
            break; 
          default: 
            break; 
          } 

          vertices[0][0]=0.0f; 
          vertices[0][1]=0.0f; 
          vertices[0][2]=radius; 

          if (qobj->orientation==GLU_OUTSIDE) 
          { 
          for (i=slices; i>=0; i--) 
          { 
           switch(qobj->normals) 
           { 
            case GLU_SMOOTH: 
             normals[slices-i+1][0]=sinCache2a[i]*sintemp3; 
             normals[slices-i+1][1]=cosCache2a[i]*sintemp3; 
             normals[slices-i+1][2]=costemp3; 
             break; 
            case GLU_FLAT: 
             if (i!=slices) 
             { 
              normals[slices-i+1][0]=sinCache3a[i+1]*sintemp3; 
              normals[slices-i+1][1]=cosCache3a[i+1]*sintemp3; 
              normals[slices-i+1][2]=costemp3; 
             } 
             else 
             { 
              /* We must add any normal here */ 
              normals[slices-i+1][0]=sinCache3a[i]*sintemp3; 
              normals[slices-i+1][1]=cosCache3a[i]*sintemp3; 
              normals[slices-i+1][2]=costemp3; 
             } 
             break; 
            case GLU_NONE: 
            default: 
             break; 
           } 
           vertices[slices-i+1][0]=sintemp2*sinCache1a[i]; 
           vertices[slices-i+1][1]=sintemp2*cosCache1a[i]; 
           vertices[slices-i+1][2]=zHigh; 
          } 
          } 
          else 
          { 
          for (i=0; i<=slices; i++) 
          { 
           switch(qobj->normals) 
           { 
            case GLU_SMOOTH: 
             normals[i+1][0]=sinCache2a[i]*sintemp3; 
             normals[i+1][1]=cosCache2a[i]*sintemp3; 
             normals[i+1][2]=costemp3; 
             break; 
            case GLU_FLAT: 
             normals[i+1][0]=sinCache3a[i]*sintemp3; 
             normals[i+1][1]=cosCache3a[i]*sintemp3; 
             normals[i+1][2]=costemp3; 
             break; 
            case GLU_NONE: 
            default: 
             break; 
           } 
           vertices[i+1][0]=sintemp2*sinCache1a[i]; 
           vertices[i+1][1]=sintemp2*cosCache1a[i]; 
           vertices[i+1][2]=zHigh; 
          } 
          } 
          glDrawArrays(GL_TRIANGLE_FAN, 0, (slices+2)); 

          /* High end next (j==stacks-1 iteration) */ 
          sintemp2=sinCache1b[stacks-1]; 
          zHigh=cosCache1b[stacks-1]; 
          switch(qobj->normals) 
          { 
          case GLU_FLAT: 
            sintemp3=sinCache3b[stacks]; 
            costemp3=cosCache3b[stacks]; 
            normals[0][0]=sinCache3a[stacks]*sinCache3b[stacks]; 
            normals[0][1]=cosCache3a[stacks]*sinCache3b[stacks]; 
            normals[0][2]=cosCache3b[stacks]; 
            break; 
          case GLU_SMOOTH: 
            sintemp3=sinCache2b[stacks-1]; 
            costemp3=cosCache2b[stacks-1]; 
            normals[0][0]=sinCache2a[stacks]*sinCache2b[stacks]; 
            normals[0][1]=cosCache2a[stacks]*sinCache2b[stacks]; 
            normals[0][2]=cosCache2b[stacks]; 
            break; 
          default: 
            break; 
          } 

          vertices[0][0]=0.0f; 
          vertices[0][1]=0.0f; 
          vertices[0][2]=-radius; 

          if (qobj->orientation==GLU_OUTSIDE) 
          { 
          for (i=0; i<=slices; i++) 
          { 
           switch(qobj->normals) 
           { 
            case GLU_SMOOTH: 
             normals[i+1][0]=sinCache2a[i]*sintemp3; 
             normals[i+1][1]=cosCache2a[i]*sintemp3; 
             normals[i+1][2]=costemp3; 
             break; 
            case GLU_FLAT: 
             normals[i+1][0]=sinCache3a[i]*sintemp3; 
             normals[i+1][1]=cosCache3a[i]*sintemp3; 
             normals[i+1][2]=costemp3; 
             break; 
            case GLU_NONE: 
            default: 
             break; 
           } 
           vertices[i+1][0]=sintemp2*sinCache1a[i]; 
           vertices[i+1][1]=sintemp2*cosCache1a[i]; 
           vertices[i+1][2]=zHigh; 
          } 
          } 
          else 
          { 
          for (i=slices; i>=0; i--) 
          { 
           switch(qobj->normals) 
           { 
            case GLU_SMOOTH: 
             normals[slices-i+1][0]=sinCache2a[i]*sintemp3; 
             normals[slices-i+1][1]=cosCache2a[i]*sintemp3; 
             normals[slices-i+1][2]=costemp3; 
             break; 
            case GLU_FLAT: 
             if (i!=slices) 
             { 
              normals[slices-i+1][0]=sinCache3a[i+1]*sintemp3; 
              normals[slices-i+1][1]=cosCache3a[i+1]*sintemp3; 
              normals[slices-i+1][2]=costemp3; 
             } 
             else 
             { 
              normals[slices-i+1][0]=sinCache3a[i]*sintemp3; 
              normals[slices-i+1][1]=cosCache3a[i]*sintemp3; 
              normals[slices-i+1][2]=costemp3; 
             } 
             break; 
            case GLU_NONE: 
            default: 
             break; 
           } 
           vertices[slices-i+1][0]=sintemp2*sinCache1a[i]; 
           vertices[slices-i+1][1]=sintemp2*cosCache1a[i]; 
           vertices[slices-i+1][2]=zHigh; 
          } 
          } 
          glDrawArrays(GL_TRIANGLE_FAN, 0, (slices+2)); 
         } 
         else 
         { 
          start=0; 
          finish=stacks; 
         } 

         for (j=start; j<finish; j++) 
         { 
          zLow=cosCache1b[j]; 
          zHigh=cosCache1b[j+1]; 
          sintemp1=sinCache1b[j]; 
          sintemp2=sinCache1b[j+1]; 
          switch(qobj->normals) 
          { 
          case GLU_FLAT: 
            sintemp4=sinCache3b[j+1]; 
            costemp4=cosCache3b[j+1]; 
            break; 
          case GLU_SMOOTH: 
            if (qobj->orientation==GLU_OUTSIDE) 
            { 
            sintemp3=sinCache2b[j+1]; 
            costemp3=cosCache2b[j+1]; 
            sintemp4=sinCache2b[j]; 
            costemp4=cosCache2b[j]; 
            } 
            else 
            { 
            sintemp3=sinCache2b[j]; 
            costemp3=cosCache2b[j]; 
            sintemp4=sinCache2b[j+1]; 
            costemp4=cosCache2b[j+1]; 
            } 
            break; 
          default: 
            break; 
          } 
          for (i=0; i<=slices; i++) 
          { 
          switch(qobj->normals) 
          { 
           case GLU_SMOOTH: 
            normals[i*2][0]=sinCache2a[i]*sintemp3; 
            normals[i*2][1]=cosCache2a[i]*sintemp3; 
            normals[i*2][2]=costemp3; 
            break; 
           case GLU_FLAT: 
            normals[i*2][0]=sinCache3a[i]*sintemp4; 
            normals[i*2][1]=cosCache3a[i]*sintemp4; 
            normals[i*2][2]=costemp4; 
            break; 
           case GLU_NONE: 
           default: 
            break; 
          } 
          if (qobj->orientation==GLU_OUTSIDE) 
          { 
           if (qobj->textureCoords) 
           { 
            texcoords[i*2][0]=1-(GLfloat)i/slices; 
            texcoords[i*2][1]=1-(GLfloat)(j+1)/stacks; 
           } 
           vertices[i*2][0]=sintemp2*sinCache1a[i]; 
           vertices[i*2][1]=sintemp2*cosCache1a[i]; 
           vertices[i*2][2]=zHigh; 
          } 
          else 
          { 
           if (qobj->textureCoords) 
           { 
            texcoords[i*2][0]=1-(GLfloat)i/slices; 
            texcoords[i*2][1]=1-(GLfloat)j/stacks; 
           } 
           vertices[i*2][0]=sintemp1*sinCache1a[i]; 
           vertices[i*2][1]=sintemp1*cosCache1a[i]; 
           vertices[i*2][2]=zLow; 
          } 
          switch(qobj->normals) 
          { 
           case GLU_SMOOTH: 
            normals[i*2+1][0]=sinCache2a[i]*sintemp4; 
            normals[i*2+1][1]=cosCache2a[i]*sintemp4; 
            normals[i*2+1][2]=costemp4; 
            break; 
           case GLU_FLAT: 
            normals[i*2+1][0]=sinCache3a[i]*sintemp4; 
            normals[i*2+1][1]=cosCache3a[i]*sintemp4; 
            normals[i*2+1][2]=costemp4; 
            break; 
           case GLU_NONE: 
           default: 
            break; 
          } 
          if (qobj->orientation==GLU_OUTSIDE) 
          { 
           if (qobj->textureCoords) 
           { 
            texcoords[i*2+1][0]=1-(GLfloat)i/slices; 
            texcoords[i*2+1][1]=1-(GLfloat)j/stacks; 
           } 
           vertices[i*2+1][0]=sintemp1*sinCache1a[i]; 
           vertices[i*2+1][1]=sintemp1*cosCache1a[i]; 
           vertices[i*2+1][2]=zLow; 
          } 
          else 
          { 
           if (qobj->textureCoords) 
           { 
            texcoords[i*2+1][0]=1-(GLfloat)i/slices; 
            texcoords[i*2+1][1]=1-(GLfloat)(j+1)/stacks; 
           } 
           vertices[i*2+1][0]=sintemp2*sinCache1a[i]; 
           vertices[i*2+1][1]=sintemp2*cosCache1a[i]; 
           vertices[i*2+1][2]=zHigh; 
          } 
          } 
          glDrawArrays(GL_TRIANGLE_STRIP, 0, (slices+1)*2); 
         } 
         break; 
        case GLU_POINT: 
         for (j=0; j<=stacks; j++) 
         { 
          sintemp1=sinCache1b[j]; 
          costemp1=cosCache1b[j]; 
          switch(qobj->normals) 
          { 
          case GLU_FLAT: 
          case GLU_SMOOTH: 
            sintemp2=sinCache2b[j]; 
            costemp2=cosCache2b[j]; 
            break; 
          default: 
            break; 
          } 

          for (i=0; i<slices; i++) 
          { 
          switch(qobj->normals) 
          { 
           case GLU_FLAT: 
           case GLU_SMOOTH: 
            normals[i][0]=sinCache2a[i]*sintemp2; 
            normals[i][1]=cosCache2a[i]*sintemp2; 
            normals[i][2]=costemp2; 
            break; 
           case GLU_NONE: 
           default: 
            break; 
          } 
          zLow=j*radius/stacks; 
          if (qobj->textureCoords) 
          { 
           texcoords[i][0]=1-(GLfloat)i/slices; 
           texcoords[i][1]=1-(GLfloat)j/stacks; 
          } 
          vertices[i][0]=sintemp1*sinCache1a[i]; 
          vertices[i][1]=sintemp1*cosCache1a[i]; 
          vertices[i][2]=costemp1; 
          } 
          glDrawArrays(GL_POINTS, 0, slices); 
         } 
         break; 
        case GLU_LINE: 
        case GLU_SILHOUETTE: 
         for (j=1; j<stacks; j++) 
         { 
          sintemp1=sinCache1b[j]; 
          costemp1=cosCache1b[j]; 
          switch(qobj->normals) 
          { 
          case GLU_FLAT: 
          case GLU_SMOOTH: 
            sintemp2=sinCache2b[j]; 
            costemp2=cosCache2b[j]; 
            break; 
          default: 
            break; 
          } 

          for (i=0; i<=slices; i++) 
          { 
          switch(qobj->normals) 
          { 
           case GLU_FLAT: 
            normals[i][0]=sinCache3a[i]*sintemp2; 
            normals[i][1]=cosCache3a[i]*sintemp2; 
            normals[i][2]=costemp2; 
            break; 
           case GLU_SMOOTH: 
            normals[i][0]=sinCache2a[i]*sintemp2; 
            normals[i][1]=cosCache2a[i]*sintemp2; 
            normals[i][2]=costemp2; 
            break; 
           case GLU_NONE: 
           default: 
            break; 
          } 
          if (qobj->textureCoords) 
          { 
           texcoords[i][0]=1-(GLfloat)i/slices; 
           texcoords[i][1]=1-(GLfloat)j/stacks; 
          } 
          vertices[i][0]=sintemp1*sinCache1a[i]; 
          vertices[i][1]=sintemp1*cosCache1a[i]; 
          vertices[i][2]=costemp1; 
          } 
          glDrawArrays(GL_LINE_STRIP, 0, slices+1); 
         } 

         for (i=0; i<slices; i++) 
         { 
          sintemp1=sinCache1a[i]; 
          costemp1=cosCache1a[i]; 
          switch(qobj->normals) 
          { 
          case GLU_FLAT: 
          case GLU_SMOOTH: 
            sintemp2=sinCache2a[i]; 
            costemp2=cosCache2a[i]; 
            break; 
          default: 
            break; 
          } 

          for (j=0; j<=stacks; j++) 
          { 
          switch(qobj->normals) 
          { 
           case GLU_FLAT: 
            normals[j][0]=sintemp2*sinCache3b[j]; 
            normals[j][1]=costemp2*sinCache3b[j]; 
            normals[j][2]=cosCache3b[j]; 
            break; 
           case GLU_SMOOTH: 
            normals[j][0]=sintemp2*sinCache2b[j]; 
            normals[j][1]=costemp2*sinCache2b[j]; 
            normals[j][2]=cosCache2b[j]; 
            break; 
           case GLU_NONE: 
           default: 
            break; 
          } 

          if (qobj->textureCoords) 
          { 
           texcoords[j][0]=1-(GLfloat)i/slices; 
           texcoords[j][1]=1-(GLfloat)j/stacks; 
          } 
          vertices[j][0]=sintemp1*sinCache1b[j]; 
          vertices[j][1]=costemp1*sinCache1b[j]; 
          vertices[j][2]=cosCache1b[j]; 
          } 
          glDrawArrays(GL_LINE_STRIP, 0, stacks+1); 
         } 
         break; 
        default: 
         break; 
       } 

       /* Disable or re-enable arrays */ 
       if (vertex_enabled) 
       { 
        /* Re-enable vertex array */ 
        glEnableClientState(GL_VERTEX_ARRAY); 
       } 
       else 
       { 
        glDisableClientState(GL_VERTEX_ARRAY); 
       } 

       if (texcoord_enabled) 
       { 
        glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
       } 
       else 
       { 
        glDisableClientState(GL_TEXTURE_COORD_ARRAY); 
       } 

       if (normal_enabled) 
       { 
        glEnableClientState(GL_NORMAL_ARRAY); 
       } 
       else 
       { 
        glDisableClientState(GL_NORMAL_ARRAY); 
       } 

       if (color_enabled) 
       { 
        glEnableClientState(GL_COLOR_ARRAY); 
       } 
       else 
       { 
        glDisableClientState(GL_COLOR_ARRAY); 
       } 
      } 

/年底/

回答

1

首先要回答這個問題,如果你正在使用ES2,您可以嘗試加載所有的16x8紋理但我要說他們的32是在iOS當前最大值(判斷從活動紋理枚舉)。如果你成功了有所有的紋理,你將需要計算要使用的紋理與質感的片段着色器座標:

int verticalTextureCount, horizontalTextureCount; //input tile count 
float texCoordX, texCoordY; //input texture coordinates 
int textureX = (int)(texCoordX*horizontalTextureCount); //texture to use 
int textureY = (int)(texCoordY*verticalTextureCount); //texture to use 
texCoordX -= (1.0/horizontalTextureCount)*textureX; //decreas offset 
texCoordY -= (1.0/verticalTextureCount)*textureY; //decreas offset 
texCoordX *= horizontalTextureCount; //rescale 
texCoordY *= verticalTextureCount; //rescale 

在這一點上,你可以寫verticalTextureCount * horizo​​ntalTextureCount「if語句」使用textureX和textureY確定使用什麼紋理和texCoors來獲取紋理。這或多或少。

第二個討論,不,不這樣做。如果紋理太大,則太大。如果我敢於猜測,我會說你正在嘗試製作一個應用程序,該應用程序具有某種你想要具有某種極端縮放功能的行星,並且你需要一些詳細的紋理。如果是這種情況或類似情況,請創建多個圖像作爲紋理使用,例如:有1個圖像,其上放置了一個整體球體,4個圖像上放置了一個球體,16個圖像...以及所有這些圖像像2048 * 2048一樣大小。

現在是最好的部分,您需要一個動態系統,根據您的需要加載和卸載圖像。如果球體縮小,則只需要1個整體圖像並按照以前的方式繪製。如果放大很多,則需要檢查最適合的紋理級別,並檢查球體的哪些部分是可見的,以便只加載所需的紋理並僅繪製可見的球體部分。這不是一件容易的事情,但它與您在3D中可以看到我們的地球的許多應用程序的原理大致相同。它會在運行時檢查星球的哪個部分,以及詳細信息,通常會向服務器發送請求,以便在需要時接收詳細圖像並創建要顯示的詳細紋理。

+0

非常感謝!實際上,我正在使用ES1.1。爲了獲得最佳的顯示效果,我必須使用大圖片作爲紋理。 – youngplayer 2013-04-11 02:08:14

+0

與其將紋理矩陣作爲整體紋理傳遞,我不得不修改對我來說更難的drawSphere函數,因爲我對OPENGL並不熟悉。 我認爲在繪圖時經常綁定紋理(繪製球體的一部分)並不是一個好主意。 所以我想用紋理矩陣作爲一種簡單而有效的方法。 – youngplayer 2013-04-11 02:30:41