Results 1 to 2 of 2

Thread: empty texture object

  1. #1

    empty texture object

    Hi ,

    I thought that the following snippet will create an empty texture object of certain width and height. But the application terminates

    Code :
    cl_mem initTexture(int width,int height)
    {
       cl_int ciErrNum;
     
       cl_image_format image_format;
       image_format.image_channel_order = CL_RGBA;
       image_format.image_channel_data_type = CL_UNSIGNED_INT8;
     
       //create an empty image 
       cl_mem imageTexture = clCreateImage2D(cxGPUContext,CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR,
    					 &image_format,width,height,0,NULL,
    					 &ciErrNum);
       oclCheckErrorEX(ciErrNum, CL_SUCCESS, pCleanup);
     
     
     
       return imageTexture;
    }


    Any idea folks ?


    Regards
    Sajjad

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Posts
    102

    Re: empty texture object

    The description of the flag CL_MEM_COPY_HOST_PTR states that "this flag is valid only if host_ptr is not NULL".

    So you must either use a valid host_ptr, or create your image without CL_MEM_COPY_HOST_PTR and use clEnqueueFillImage.

Similar Threads

  1. Low fps even on empty canvas.
    By sphere in forum WebGL - General
    Replies: 34
    Last Post: 01-29-2011, 11:33 AM
  2. Change texture on an object
    By bzhou in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 05-08-2009, 11:49 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
  •