# CLMem (LWJGL API)
Date: 2015-07-28

## org.lwjgl.opencl
Class CLMem

    java.lang.Object
      org.lwjgl.PointerWrapperAbstract
          org.lwjgl.opencl.CLMem

All Implemented Interfaces:
  PointerWrapper

    public final class CLMem

extends PointerWrapperAbstract

This class is a wrapper around a cl_mem pointer.

Author:
  Spasi

Field Summary

Fields inherited from class org.lwjgl.PointerWrapperAbstract
`pointer`

Method Summary
`static CLMem` `createImage2D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_row_pitch, java.nio.Buffer host_ptr, java.nio.IntBuffer errcode_ret)` Creates a new 2D image object.
`static CLMem` `createImage3D(CLContext context, long flags, CLImageFormat image_format, long image_width, long image_height, long image_depth, long image_row_pitch, long image_slice_pitch, java.nio.Buffer host_ptr, java.nio.IntBuffer errcode_ret)` Creates a new 3D image object.
`CLMem` `createSubBuffer(long flags, int buffer_create_type, CLBufferRegion buffer_create_info, java.nio.IntBuffer errcode_ret)`
`int` `getGLObjectName()` Returns the GL object name.
`int` `getGLObjectType()` Returns the GL object type.
`int` `getGLTextureInfoInt(int param_name)` Returns the int value of the specified parameter.
`int` `getImageChannelOrder()` Returns the image channel order.
`int` `getImageChannelType()` Returns the image channel type.
`CLImageFormat` `getImageFormat()` Returns the image format.
`long` `getImageInfoSize(int param_name)` Returns the size_t value of the specified parameter.
`java.nio.ByteBuffer` `getInfoHostBuffer()` Returns a direct ByteBuffer instance that points to the host memory that backs this CLMem object.
`int` `getInfoInt(int param_name)` Returns the integer value of the specified parameter.
`long` `getInfoLong(int param_name)` Returns the long value of the specified parameter.
`long` `getInfoSize(int param_name)` Returns the size_t value of the specified parameter.
`P` `getParent()`
`int` `getReferenceCount()`
`boolean` `isValid()` Returns true if this object represents a valid pointer.

Methods inherited from class org.lwjgl.PointerWrapperAbstract
`checkValid, equals, getPointer, hashCode, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### createImage2D

    public static CLMem createImage2D(CLContext context,
                                      long flags,
                                      CLImageFormat image_format,
                                      long image_width,
                                      long image_height,
                                      long image_row_pitch,
                                      java.nio.Buffer host_ptr,
                                      java.nio.IntBuffer errcode_ret)

  Creates a new 2D image object.

  Parameters:
    `context` - the context on which to create the image object
    `flags` - the memory object flags
    `image_format` - the image format
    `image_width` - the image width
    `image_height` - the image height
    `image_row_pitch` - the image row pitch
    `host_ptr` - the host buffer from which to read image data (optional)
    `errcode_ret` - the error code result
  Returns:
    the new CLMem object

### createImage3D

    public static CLMem createImage3D(CLContext context,
                                      long flags,
                                      CLImageFormat image_format,
                                      long image_width,
                                      long image_height,
                                      long image_depth,
                                      long image_row_pitch,
                                      long image_slice_pitch,
                                      java.nio.Buffer host_ptr,
                                      java.nio.IntBuffer errcode_ret)

  Creates a new 3D image object.

  Parameters:
    `context` - the context on which to create the image object
    `flags` - the memory object flags
    `image_format` - the image format
    `image_width` - the image width
    `image_height` - the image height
    `image_depth` - the image depth
    `image_row_pitch` - the image row pitch
    `image_slice_pitch` - the image slice pitch
    `host_ptr` - the host buffer from which to read image data (optional)
    `errcode_ret` - the error code result
  Returns:
    the new CLMem object

### createSubBuffer

    public CLMem createSubBuffer(long flags,
                                 int buffer_create_type,
                                 CLBufferRegion buffer_create_info,
                                 java.nio.IntBuffer errcode_ret)

### getInfoInt

    public int getInfoInt(int param_name)

  Returns the integer value of the specified parameter.

  Parameters:
    `param_name` - the parameter
  Returns:
    the parameter value

### getInfoSize

    public long getInfoSize(int param_name)

  Returns the size_t value of the specified parameter.

  Parameters:
    `param_name` - the parameter
  Returns:
    the parameter value

### getInfoLong

    public long getInfoLong(int param_name)

  Returns the long value of the specified parameter. Can be used for both cl_ulong and cl_bitfield parameters.

  Parameters:
    `param_name` - the parameter
  Returns:
    the parameter value

### getInfoHostBuffer

    public java.nio.ByteBuffer getInfoHostBuffer()

  Returns a direct ByteBuffer instance that points to the host memory that backs this CLMem object. Applicable only to CLMem objects that were created with the CL_MEM_USE_HOST_PTR flag.

  Returns:
    the host memory ByteBuffer

### getImageInfoSize

    public long getImageInfoSize(int param_name)

  Returns the size_t value of the specified parameter. Applicable to image objects only.

  Parameters:
    `param_name` - the parameter
  Returns:
    the parameter value

### getImageFormat

    public CLImageFormat getImageFormat()

  Returns the image format. Applicable to image objects only.

  Returns:
    the parameter value

### getImageChannelOrder

    public int getImageChannelOrder()

  Returns the image channel order. Applicable to image objects only.

  Returns:
    the parameter value

### getImageChannelType

    public int getImageChannelType()

  Returns the image channel type. Applicable to image objects only.

  Returns:
    the parameter value

### getGLObjectType

    public int getGLObjectType()

  Returns the GL object type. Applicable to CLMem objects that have been created GL objects only.

  Returns:
    the parameter value

### getGLObjectName

    public int getGLObjectName()

  Returns the GL object name. Applicable to CLMem objects that have been created GL objects only.

  Returns:
    the parameter value

### getGLTextureInfoInt

    public int getGLTextureInfoInt(int param_name)

  Returns the int value of the specified parameter. Applicable to CLMem objects that have been created by GL textures only.

  Parameters:
    `param_name` - the parameter
  Returns:
    the parameter value

### getParent

    public P getParent()

### getReferenceCount

    public final int getReferenceCount()

### isValid

    public final boolean isValid()

  Description copied from class: `PointerWrapperAbstract`
  Returns true if this object represents a valid pointer. The pointer might be invalid because it is NULL or because some other action has deleted the object that this pointer represents.

  Overrides:
    `isValid` in class `PointerWrapperAbstract`
  Returns:
    true if the pointer is valid

Copyright © 2002-2009 lwjgl.org. All Rights Reserved.