| Home | Libraries | People | FAQ | More

## Class opengl_texture

boost::compute::opengl_texture

## Synopsis

    // In header: <boost/compute/interop/opengl/opengl_texture.hpp>

    class opengl_texture : public boost::compute::image_object {
    public:
      // construct/copy/destruct
      opengl_texture();
      explicit opengl_texture(cl_mem, bool = true);
      opengl_texture(const context &, GLenum, GLint, GLuint,
                     cl_mem_flags = read_write);
      opengl_texture(const opengl_texture &);
      opengl_texture & operator=(const opengl_texture &);
      ~opengl_texture();

      // public member functions
      extents< 2 > size() const;
      extents< 2 > origin() const;
      template<typename T> T get_texture_info(cl_gl_texture_info) const;
    };

## Description

A OpenCL image2d for accessing an OpenGL texture object.

### `opengl_texture` public construct/copy/destruct

1.     opengl_texture();

   Creates a null OpenGL texture object.

2.     explicit opengl_texture(cl_mem mem, bool retain = true);

   Creates a new OpenGL texture object for `mem`.

3.     opengl_texture(const context & context, GLenum texture_target, GLint miplevel,
                      GLuint texture, cl_mem_flags flags = read_write);

   Creates a new OpenGL texture object in `context` for `texture` with `flags`.

   See the documentation for clCreateFromGLTexture() for more information.

4.     opengl_texture(const opengl_texture & other);

   Creates a new OpenGL texture object as a copy of `other`.

5.     opengl_texture & operator=(const opengl_texture & other);

   Copies the OpenGL texture object from `other`.

6.     ~opengl_texture();

   Destroys the texture object.

### `opengl_texture` public member functions

1.     extents< 2 > size() const;

   Returns the size (width, height) of the texture.

2.     extents< 2 > origin() const;

   Returns the origin of the texture (`0`, `0`).

3.     template<typename T> T get_texture_info(cl_gl_texture_info info) const;

   Returns information about the texture.

   See the documentation for clGetGLTextureInfo() for more information.