def main(argv):

    app = QtGui.QApplication(sys.argv)

    widget = CGLPlotWidget(aspect=1)

    gl_context = widget.context()
    gl_context.makeCurrent()


    data = np.array(image[:, :, :3].sum(-1), dtype=np.float32)
    shape = list(data.shape)
    print shape

    plat, = cl.get_platforms()
    ati, intel = plat.get_devices()
    print intel

    cl_context = cl.Context(devices=[intel])

    implot = ImagePlot(widget.context(), cl_context, shape, share=False, interp=Interp.NEAREST)

    cl_data = cl.Buffer(cl_context, cl.mem_flags.READ_WRITE, data.nbytes)

    import pylab
    cdict = pylab.cm.jet._segmentdata
    pipe_segment = ColorMap(gl_context, cl_context, cdict,
                                     cl_data, implot.texture.cl_image,
                                     shape, clim=(np.float32(data.min()), np.float32(data.max()))
                                     )

    cl.enqueue_copy(implot.queue, cl_data, data)

    implot.queue.finish()

    implot._pipe_segments.append(pipe_segment)

    implot.process()

    widget.add_plot(implot)

    widget.show()
    widget.resize(480, 640,)

    bring_to_front()

    sys.exit(app.exec_())