Results 1 to 3 of 3

Thread: glTexImage2D and glGetTexImage Issue

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    5

    glTexImage2D and glGetTexImage Issue


    I m trying to test glTexImage2D and glGetTexImage but it does not seem to work

    i m filling a input texture with 5 but when geeting the data using glGetTexImage it contains only 0. where i m wrong ?

    unsigned short* data = new unsigned short[32*32]();
    for(int i = 0 ; i < 32*32 - 1; i++)
    {
    data[i] = 5;
    }

    GLuint textureID;
    glGenTextures(1, &amp;textureID);

    glBindTexture(GL_TEXTURE_2D, textureID);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA16F_ARB, 32, 32, 0, GL_ALPHA16, GL_UNSIGNED_SHORT, data);




    unsigned short *pVolumedata = new unsigned short[32*32]();
    glBindTexture(GL_TEXTURE_2D, textureID);
    glGetTexImage( GL_TEXTURE_2D, 0, GL_ALPHA16F_ARB, GL_UNSIGNED_SHORT, pVolumedata );



    delete data;
    delete pVolumedata;

  2. #2
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: glTexImage2D and glGetTexImage Issue

    Can you use float textures with glGetTexImage?
    I am not sure that you can.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    5

    Re: glTexImage2D and glGetTexImage Issue

    but i want to read a float texture, then how should i do it.

Similar Threads

  1. segfault after glGetTexImage
    By _NoName_ in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 10-22-2016, 08:20 PM
  2. glGetTexImage
    By cruachan in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 05-19-2005, 05:24 PM
  3. FBO + glGetTexImage == no go?
    By ScottManDeath in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-10-2005, 10:25 AM
  4. Using WGL_ARB_pbuffer and glGetTexImage
    By Arkion in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 08-29-2004, 02:19 PM
  5. glGetTexImage() problem
    By Sancho in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 03-24-2003, 04:41 AM

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