Results 1 to 4 of 4

Thread: Problems with texture PCX

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    5

    Problems with texture PCX

    Hi to everybody.
    I have problem with a texture mapping. I want to load a texture on a mesh from a file PCX.
    The result is very strange. I have the mesh loaded in a good way but the texture is not correct. I paste here the code what does that.

    before the is the code necessary for convert the PCX image, and I am sure it's correct.

    glEnable(GL_TEXTURE_2D);
    glGenTextures(1, &texID);
    glBindTexture(GL_TEXTURE_2D, texID);


    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );

    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0 ,GL_RGB,
    GL_UNSIGNED_BYTE,imageData);
    gluBuild2DMipmaps(
    GL_TEXTURE_2D,
    GL_RGB,
    width,height,
    GL_RGB,
    GL_UNSIGNED_BYTE,
    imageData
    );


    glEnable(GL_TEXTURE_GEN_S);
    glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR);
    float v0[4]={0,0,1,0};
    glTexGenfv(GL_S,GL_EYE_PLANE,v0);

    glEnable(GL_TEXTURE_GEN_T);
    glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_EYE_LINEAR);
    float v1[4]={1,0,0,0};
    glTexGenfv(GL_T,GL_EYE_PLANE,v1);
    glEnable(GL_TEXTURE_2D);
    }

    Then, when I paint the mesh (ANI format)

    glBegin(GL_TRIANGLES);

    for (int i=0; i nfac; i++){
    int indice;
    indice = f[i].v0;

    glTexCoord2f(s[indice].s0,t[indice].t0);
    glVertex3f( v[ indice ].x, v[ indice ].y,v[ indice ].z );

    indice = f[i].v1;
    glTexCoord2f(s[indice].s1,t[indice].t1);
    glVertex3f( v[ indice ].x, v[ indice ].y,v[ indice ].z );

    indice = f[i].v2;
    glTexCoord2f(s[indice].s2,t[indice].t2);
    glVertex3f( v[ indice ].x, v[ indice ].y,v[ indice ].z );

    }
    glEnd();

    The data structure is correct.

    That is the result I have
    http://putfile.com/pic.php?pic=8/21211505874.jpg&s=x1

    Thank a lot!

  2. #2
    Guest

    Re: Problems with texture PCX

    Looks very noisy. You sure your texture is OK? Aware you are generating mipmaps but not using them?

    At a glance, I don't see anything wrong with the disjointed snippets you posted, but that doesn't mean much. Could be any number of things. Can you post some testable code?


  3. #3
    Junior Member Newbie
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    5

    Re: Problems with texture PCX

    Do you want all the code? I use different files for the data structure and I use a function to read the vertex, faces and texture coordinates from the file ANI

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Problems with texture PCX

    Can you map a single quad, it would be easier to check.

Similar Threads

  1. Problems Texture Mapping with Float Texture
    By CelticBlues in forum OpenGL: GLSL
    Replies: 21
    Last Post: 02-08-2009, 04:13 AM
  2. More texture problems: here we go....again!
    By gui24a in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 08-25-2008, 12:30 PM
  3. Texture Problems ...
    By Saintex in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 07-22-2002, 07:38 AM
  4. Texture Problems
    By spectrum in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 01-09-2002, 02:58 AM
  5. AVI texture problems
    By dmsy in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-12-2000, 01:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean