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 3 of 3

Thread: segfault after glGetTexImage

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2016
    Posts
    19

    segfault after glGetTexImage

    Im trying to save my rendered image as a .ppm file but if I use glGetTexImage() and after that glUseProgram() I always get segmentation fault.
    Do anyone know why I get this error.
    This is the way I get my texture data : glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_BYTE, pixelBuffer);
    (If I dont use glGetTexImage I dont get any error).

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,687
    Is pixelBuffer sized large enough to recieve the data?

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Quote Originally Posted by mhagain View Post
    Is pixelBuffer sized large enough to recieve the data?
    And if you are expecting tightly-package RGB8 data to be returned, have you specified:

    Code cpp:
    glPixelStorei(GL_PACK_ALIGNMENT, 1)

    For details, see this section in the OpenGL wiki:

    * Common_Mistakes#Texture_upload_and_pixel_reads

Tags for this Thread

Posting Permissions

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