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

Thread: copy data to textures

  1. #1
    Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    466

    copy data to textures

    Hi,

    I'm facing a little problem. I think it must be an easy thing, but I really can't figure it out.

    I have, for my internship, to copy what's rendered on the screen into textures (here cubemap textures).

    When I use gluBuild2DMipmaps the data is copied into the texture (I then use glReadPixel before). When I use glTexImage2D (with same glReadPixel before), no data are copied.
    The same, and was my first try: glCopyTexImage2D does not copy data to the texture.

    I've did this many times before (including glCopyTexImage2D) without issues at all. But here, I can't figure out to make glCopyTexImage2D to work.

    I use GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB+i (with i an integer between 0 and 5) as format for all tested functions, GL_RGB8 as internal format.

    Something says me it might be the mipmap level since gluBuild2DMipmaps works but not the others ones but I can't understand why.

    Any hints ?

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2010
    Posts
    495

    Re: copy data to textures

    How do you verify that something was copied? If you render something with the copied texture data and you use a minification filter that uses mipmapping you need to provide all levels. Try rendering with something like GL_LINEAR.

  3. #3
    Member Regular Contributor remdul's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands
    Posts
    335

    Re: copy data to textures

    Is the image black? As the poster before me indicated, you must ensure that the mipmap chain is complete (assuming mipmapping is enabled and desired). If this is the case, your best option is to enable automatic mipmap generation with GL_GENERATE_MIPMAP_SGIS. You can then just make one call to glTexImage2D for level 0, and GL takes care of the rest.

    http://www.opengl.org/registry/specs...ate_mipmap.txt

    And for alternatives, see GL wiki: http://www.opengl.org/wiki/Texture

  4. #4
    Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    466

    Re: copy data to textures

    I textured an object to verify the data. Plus I created image files of glReadPixel.

    Anyway, thank you a lot. My texture creation model used mipmapping for minification (I used the same as for the previous cubemap one).

    Sorry for the bothering...

Posting Permissions

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