Using a Higher Precision (than 8-bit unsigned integer) Buffered Image for Heightmaps in Java

Posted by pl12 on Game Development See other posts from Game Development or by pl12
Published on 2013-08-10T21:53:59Z Indexed on 2013/11/11 4:16 UTC
Read the original article Hit count: 207

Filed under:
|

I am generating a heightmap for every quad in my quadtree in openCL. The way I was creating the image is as follows:

DataBufferInt dataBuffer =
            (DataBufferInt)img.getRaster().getDataBuffer();
      int data[] = dataBuffer.getData();
      //img is a bufferedimage 
        inputImageMem = CL.clCreateImage2D(
        context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
        new cl_image_format[]{imageFormat}, size, size,
        size * Sizeof.cl_uint, Pointer.to(data), null);

This works ok but the major issue is that as the quads get smaller and smaller the 8-bit format of the buffered image starts to cause intolerable "stepping" issues as seen below:

enter image description here

I was wondering if there was an alternate way I could go about doing this?

Thanks for the time.

© Game Development or respective owner

Related posts about java

Related posts about heightmap