Implementing small loop and OpenGL rendering