Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Pict Textures

  1. #1
    Guest

    Pict Textures

    I've been using this code to load a Pict file and then use it as a texture, but, glTexImage2D() had been giving me fits; the variable PICTDATA cannot be used as a pointer to the image data. What is the problem?
    Here is the code:

    void GETPICT(Str255 NAME); //All files must be 256x256
    void GETPICT(Str255 NAME)
    {
    OSErr noError;
    long DIRID;
    short REFERENCEID;
    long PICTSIZE;
    Ptr PICTDATA;

    DIRID = LMGetCurDirStore();

    noError = HOpen(0, DIRID, NAME, fsRdWrPerm, &REFERENCEID);

    if (!noError)
    ExitToShell();

    noError = GetEOF(REFERENCEID, &PICTSIZE);

    if (!noError)
    ExitToShell();

    PICTSIZE = PICTSIZE - 512;

    noError = SetFPos(REFERENCEID, fsFromStart, 512);

    if (!noError)
    ExitToShell();

    noError = FSRead(REFERENCEID, &PICTSIZE, PICTDATA);

    if (!noError)
    ExitToShell();

    glPixelStorei(GL_UNPACK_ALIGNMENT, 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, 256, 256, GL_RGB, GL_INT, PICTDATA);

    glEnable(GL_TEXTURE_2D);
    }

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2000
    Location
    Mexico City
    Posts
    20

    Re: Pict Textures

    The problem is that the pict data you are reading directly from the file is stored
    in compressed form, to get the pict file
    in to texture memory you should decompress it first , for anyone interested
    in some good code to get pict files in to texture memory including the alpha channel please e-mail me at jchavezh@tvazteca.com.mx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •