private void run(){
        int frames = 0;
        double frameCounter = 0;

        double lastTime = Time.getTime();
        double unprocessedTime = 0;


        while (running){

            boolean render = false;

            double startTime = Time.getTime();
            double passedTime = startTime - lastTime;
            lastTime = startTime;

            unprocessedTime += passedTime;
            frameCounter += passedTime;

            while (unprocessedTime > frameTime){

                render = true;

                unprocessedTime -= frameTime;

                if (Window.isCloseRequested())
                    stop();

                Input.update();

                screen.update((float)frameTime);

                if (frameCounter >= 1.0){
                    System.out.println("FPS: " + frames);
                    frames = 0;
                    frameCounter = 0;
                }
            }

            if (render){
                glClearColor(0.7f, 0.7f, 0.7f, 1.0f);
                glClear(GL_COLOR_BUFFER_BIT);
//                glLoadIdentity();
                screen.render();
                Window.render();
                frames++;
            }else {
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }

        cleanUp();
    }