Thread: Textring Problem: Bad coloring

  1. #1
    Christian
    Join Date
    Mar 2002
    Posts
    612

    Textring Problem: Bad coloring

    APIs: Opengl, with SDL (and SDL_mixer)
    Compiler: Borland Comand Line

    Problem: The coloring of my textures does not match the bitmap they were created from.

    Code: Texture Loading
    Code:
    int loadGLTexture ()
    {
    printf("starting Load texture\n");
    int status = FALSE;
    SDL_Surface *textureImage[1];
    textureImage[0]=SDL_LoadBMP("texture.bmp");
    if (textureImage[0])
    {
    printf ("textre Loaded \n");
    status = TRUE;
    glGenTextures(1, &textures[0]);
    glBindTexture(GL_TEXTURE_2D, textures[0]);
    glTexImage2D(GL_TEXTURE_2D, 0, 3, textureImage[0]->w, textureImage[0]->h,
    0, GL_RGB, GL_UNSIGNED_BYTE, textureImage[0]->pixels);
    
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    }
    if (textureImage[0])
    SDL_FreeSurface(textureImage[0]);
    printf("done with Load texture");
    return status;
    Screen shot: compariosn of Bitmap, and paddle with texture applied.
    I shall call egypt the harmless dragon

    -Isaiah 30.7

  2. #2
    Registered User Spleeneraclingy's Avatar
    Join Date
    May 2002
    Posts
    16
    Well, I know very little about OpenGL, but I belive you should do glColor3f(1.0f, 1.0f, 1.0f); before drawing the object you want to texture.
    (Assuming you didn't already do that)
    "Life's short and hard, like a bodybuilding elf."

  3. #3
    Christian
    Join Date
    Mar 2002
    Posts
    612
    Thanks for the help, but that is not the problem. When sdl loaded my texture, it swaped the red and blue. So now I need add a red and blue deswaper.
    I shall call egypt the harmless dragon

    -Isaiah 30.7

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Minor problem...bad stuff
    By beene in forum Windows Programming
    Replies: 19
    Last Post: 10-21-2006, 06:11 AM
  2. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  3. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  4. linked list problem
    By kzar in forum C Programming
    Replies: 8
    Last Post: 02-05-2005, 04:16 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM