Converted sample to use opengl