# MikTeX How to install glut library on windows?

With the 6300 version of MikTeX, which did not include Asymptote, it was possible to compile all .asy extension files without any problem on the command line. When they were ready, they could then be included in a TEX file to obtain a pdf.

MikTeX asymptote

Since the 6400 version of MikTeX which includes Asymptote, I can no longer compile .asy extension files using the three module directly via the command line. The code below that produces a cube in 3D manipulable with the mouse. It gives the following error when compiled in command line:

C:\Program Files\MiKTeX 2.9/asymptote/three.asy: 2905.13: runtime: to support onscreen rendering, please install glut library, run ./configure, and recompile

import three;
currentlight=nolight;
settings.tex="latex"; // Moteur LaTeX utilisé pour la compilation (latex, pdflatex, ...)
settings.outformat="pdf"; // Format de sortie ; eps par défaut
settings.prc=true; // Format PRC de la figure ; vrai par défaut
settings.render=4; // Rendu des figures ; -1 par défaut
currentprojection=orthographic(
camera=(11.8235956621239,4.72943826484957,7.09415739727435),
up=(-0.014547132307495,-0.005818852922998,0.0281244557944903),
target=(1.90038956793259e-15,8.63024929298462e-16,2.51968584885631e-16),
zoom=0.7);
size(2.5cm,0);
real a = 0.05;
draw(box(O, 84a*(-X+Y+Z)), heavycyan);


But the same code included in a .tex file does not pose any problem after a triple compilation PDFLaTeX -> Asymptote -> PDFLaTeX as it should be done with Asymptote.

    \documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage[inline]{asymptote}
\begin{document}
\begin{asy}
import three;
currentlight=nolight;
settings.tex="latex";
settings.outformat="pdf"; // Format de sortie ; eps par défaut
settings.prc=true; // Format PRC de la figure ; vrai par défaut
settings.render=4; // Rendu des figures ; -1 par défaut
currentprojection=orthographic(
camera=(11.8235956621239,4.72943826484957,7.09415739727435),
up=(-0.014547132307495,-0.005818852922998,0.0281244557944903),
target=(1.90038956793259e-15,8.63024929298462e-16,2.51968584885631e-16),
zoom=0.7);
size(2.5cm,0);
real a = 0.05;
draw(box(O, 84a*(-X+Y+Z)), heavycyan);
\end{asy}
\end{document}


Output:

The odd thing is that after installing Asymptote on Windows like we used to do with the .exe extension file, we can compile without errors from TeXmaker, both the .asy file and the .tex file, but this is still impossible in Windows command line.

[\Edit]

It is very convenient to be able to compile Asymptote files on the command line before including them in a TeX file because the compilation is really much faster.

So, how to install the glut library on windows?

• There is something not correctly working. But it is not quite easy to pin it down, your two examples are not exactly identical and they are also rather complicated. When I compile with texlive at the end a preview open. If I should guess that this library is missing in miktex but I'm not sure. Try to make a simpler example and then make a bug report (don't attach to an older one, create a new one: github.com/MiKTeX/miktex). – Ulrike Fischer Oct 28 '17 at 16:48
• @Ulrike Fischer That's it, I just simplified the code and the error is still there. – AndréC Oct 29 '17 at 9:05
• The odd thing is that after installing Asymptote on Windows like we used to do with the .exe extension file, we can compile without errors from TeXmaker, both the .asy file and the .tex file, but this is still impossible in Windows command line. – AndréC Oct 29 '17 at 11:49
• I made a bug report regarding the renderer github.com/MiKTeX/miktex/issues/26. Beside this imho the main problem with your example is that you are setting the pdf-output format and the render value too late. Move them before import threes. It probably works in texmaker but not in cmd on your system because of difference in the PATH-variable. – Ulrike Fischer Oct 29 '17 at 16:52

OpenGL support isn't currently implemented in the native MiKTeX port of asymptote.

This means that you should ensure that your code doesn't try to call the OpenGL renderer. Your example compiles (and creates a pdf which is then open in the adobe reader) if I move the outformat and render declaration before import three

import settings;
outformat="pdf";
render=-1;
import three;
currentlight=nolight;
settings.tex="latex"; // Moteur LaTeX utilisé pour la compilation (latex, pdflatex, ...)
currentprojection=orthographic(
camera=(11.8235956621239,4.72943826484957,7.09415739727435),
up=(-0.014547132307495,-0.005818852922998,0.0281244557944903),
target=(1.90038956793259e-15,8.63024929298462e-16,2.51968584885631e-16),
zoom=0.7);
size(2.5cm,0);
real a = 0.05;
draw(box(O, 84a*(-X+Y+Z)), heavycyan);

• Thank you for creating this bug report, I hope it will solve this problem. The problem still arises if I compile on the Windows command line. Nevertheless, I have come to understand that there is an alternative by compiling the asymptote files directly with the asymptote software itself instead of the Windows command line. – AndréC Oct 29 '17 at 20:45
• Great catch! As a general rule you should always set up your settings before importing anything (especially three). – Charles Staats Nov 1 '17 at 22:52
• I haven't had time to check yet, but there's something new:" MiKTeX for Windows now includes GLUT, an OpenGL utility toolkit. This addition enables 3D rendering support in MiKTeX-Asymptote " miktex.org/announcement/asy-244 – AndréC Sep 9 '18 at 14:22
• I just checked it works thanks a lot for your bug report! – AndréC Sep 9 '18 at 14:28