if (?(args) and args at(0)) then (path = args at(0)) else ( path = launchPath appendPath("images/lotus.jpg") ) image = Image clone open(path) if (image error, write("Error: ", image error, "\n"); exit) windowName = path lastPathComponent .. " " .. image width .. "x" .. image height Screen = Object clone Screen parent = OpenGL Screen reshape = method(w, h, self width = w self height = h glViewport( 0 ,0,w,h) glLoadIdentity gluOrtho2D(0,w,0,h) glutPostRedisplay ) Screen display = method( glClearColor(1, 1, 1, 1) glClear(GL_COLOR_BUFFER_BIT) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glPushMatrix glTranslated(width/2 - image width/2, height/2 - image height/2, 0) glRasterPos2d(0,0) image draw if (image error, write("Error: ", image error, "\n"); exit) glPopMatrix glFlush glutSwapBuffers ) Screen run = method( glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutInitWindowSize(image width, image height) glutInit glutCreateWindow(windowName) glutEventTarget(Screen) glutDisplayFunc glutReshapeFunc //image scaleTo(image width * 2, image height * 2) //image save(launchPath .. "/images/lotus2.jpg") glutMainLoop ) Screen run