现在在编那个opengl程序 
下面是有问题的一下段 请大家帮我分析一下:
int CMyView::LoadGLTextures()
{
        int Status=FALSE;                               // Status Indicator        AUX_RGBImageRec *TextureImage[3];               // Create Storage Space For The Texture        memset(TextureImage,0,sizeof(void *)*1);        // Set The Pointer To NULL        if (TextureImage[0]=LoadBMP("Star.bmp"))
        {
                Status=TRUE;                            // Set The Status To TRUE                glGenTextures(1, &textures[0]);          // Create One Texture                glBindTexture(GL_TEXTURE_2D, textures[0]);
                glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
                glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
                glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
        }
        
//////
          if (TextureImage[1]=LoadBMP("Star.bmp"))
        {
                Status=TRUE;                            // Set The Status To TRUE                glGenTextures(1, &textures[1]);          // Create One Texture                glBindTexture(GL_TEXTURE_2D, textures[1]);
                glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
                glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
                glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[1]->sizeX, TextureImage[1]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[1]->data);
        }
  /////
   if (TextureImage[2]=LoadBMP("Star.bmp"))
        {
                Status=TRUE;                            // Set The Status To TRUE                glGenTextures(1, &textures[2]);          // Create One Texture                glBindTexture(GL_TEXTURE_2D, textures[2]);
                glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
                glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
                glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[2]->sizeX, TextureImage[2]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[2]->data);
        }
        if (TextureImage[0])                            // If Texture Exists
        {
                if (TextureImage[0]->data)              // If Texture Image Exists
                {
                        free(TextureImage[0]->data);    // Free The Texture Image Memory
                }                free(TextureImage[0]);                  // Free The Image Structure
        }
if (TextureImage[1])                            // If Texture Exists
        {
                if (TextureImage[1]->data)              // If Texture Image Exists
                {
                        free(TextureImage[1]->data);    // Free The Texture Image Memory
                }                free(TextureImage[1]);                  // Free The Image Structure
        }
if(TextureImage[2])
{
if(TextureImage[2]->data)
{
free(TextureImage[2]->data);
}
free(TextureImage[2]);
}
        return Status;     }
每次编译的时候都有下面这个错误:
--------------------Configuration: 滚动烟花 - Win32 Debug--------------------
Compiling...
滚动烟花View.cpp
D:\vc的程序作业\滚动烟花\滚动烟花View.cpp(309) : error C2664: 'glGenTextures' : cannot convert parameter 2 from 'int *' to 'unsigned int *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\vc的程序作业\滚动烟花\滚动烟花View.cpp(322) : error C2664: 'glGenTextures' : cannot convert parameter 2 from 'int *' to 'unsigned int *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\vc的程序作业\滚动烟花\滚动烟花View.cpp(334) : error C2664: 'glGenTextures' : cannot convert parameter 2 from 'int *' to 'unsigned int *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.滚动烟花.exe - 3 error(s), 0 warning(s)等待中谢谢!

解决方案 »

  1.   

    GLuint texture[1];
    glGenTextures(1, &texture[0]);ur texture is defined as this?
      

  2.   

    是的 
    GLuint textures[3];不知道为什么会这样
      

  3.   

    glGenTextures(3, &texture[0]);// 创建纹理
    告诉OpenGL我们要创建三个纹理,它们将存放在texture[0], texture[1] 和 texture[2] 中。
    楼主只是要加载一个纹理.我认为只要这样写就可以了啊
    --------------------------------------------------------
    int LoadGLTextures()
    {
      int Status=FALSE; // Status 状态指示器
      AUX_RGBImageRec *TextureImage[1]; // 创建纹理的存储空间
      memset(TextureImage,0,sizeof(void *)*1); // 将指针设为 NULL
      LPCWSTR filename = _T("Star.bmp");
      TextureImage[0] = auxDIBImageLoad (filename);  if (TextureImage[0])
      {
        Status=TRUE; // 将 Status 设为 TRUE
        glGenTextures(3, &texture[0]); // 创建纹理
        // 创建 Nearest 滤波贴图
        glBindTexture(GL_TEXTURE_2D, texture[0]);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);  // ( 新增 )
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // ( 新增 )
        glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
        // 创建线性滤波纹理
        glBindTexture(GL_TEXTURE_2D, texture[1]);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
         // 创建 MipMapped 纹理
        glBindTexture(GL_TEXTURE_2D, texture[2]);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); // ( 新增 ) 
        gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data); //( 新增 )
    }
      if (TextureImage[0]) // 纹理是否存在
      {
        if (TextureImage[0]->data) // 纹理图像是否存在
        {
          free(TextureImage[0]->data); // 释放纹理图像占用的内存
        }
        free(TextureImage[0]); // 释放图像结构
      }
       return Status; }
      

  4.   

    memset(TextureImage,0,sizeof(void *)*3);
      

  5.   

    分别改  glGenTextures(1, &textures[0]); 
            glGenTextures(2, &textures[1]); 
            glGenTextures(3, &textures[2]);