Using a Higher Precision (than 8-bit unsigned integer) Buffered Image for Heightmaps in Java
- by pl12
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:
I was wondering if there was an alternate way I could go about doing this?
Thanks for the time.