PDA

View Full Version : How to install glut library on windows?



AndréC
10-28-2017, 03:04 AM
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.

https://miktex.org/announcement/miktex-2-9-6400

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;
currentprojection =orthographic((5,2,3));
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=-1; // Rendu des figures ; -1 par défaut
size(6cm,0);
real a = 0.05;
real h=0.001;
path carre = box ((0,0),(84a,84a)),
disque = scale(9a)*unitcircle,
patron1[] = shift(42a,42a)*disque,
patron2[] = shift(14a,70a)*disque^^shift(70a,14a)*disque,
patron3[] = shift(14a,70a)*disque^^shift(70a,14a)*disque^^shif t(42a,42a)*disque,
patron4[] = shift(14a,14a)*disque^^shift(14a,70a)*disque^^shif t(70a,14a)*disque^^shift(70a,70a)*disque,
patron5[] = shift(14a,14a)*disque^^shift(14a,70a)*disque^^shif t(70a,14a)*disque^^shift(70a,70a)*disque^^shift(42 a,42a)*disque,
patron6[] = shift(14a,14a)*disque^^shift(14a,70a)*disque^^shif t(70a,14a)*disque^^shift(70a,70a)*disque^^shift(42 a,70a)*disque^^shift(42a,14a)*disque;

transform3 tX=shift((84a+h)*X), tY=shift((84a+h)*Y), tZ=shift((84a+h)*Z);

path3 facegauche[] =shift(0,-h,0)*path3(patron6,ZXplane),
facedroite[] =path3(patron1,ZXplane),
faceavant[] =path3(patron2,YZplane),
facearriere[] =shift(-h,0,0)*path3(patron5,YZplane),
facehaut[] =path3(patron4,XYplane),
facebas[] =shift(0,0,-h)*path3(patron3,XYplane);

draw(O--4.2X ^^ O--4.2Y ^^ O--4.2Z);
draw(scale3(84a)*unitcube, surfacepen=white);
draw(box(O, 84a*(X+Y+Z)), gray);
draw(surface(facegauche),blue);
draw(surface(tY*facedroite),blue);
draw(surface(tZ*facehaut),blue);
draw(surface(facebas),blue);
draw(surface(facearriere),blue);
draw(surface(tX*faceavant),blue);

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;
currentprojection =orthographic((5,2,3));
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=-1; // Rendu des figures ; -1 par défaut
size(6cm,0);
real a = 0.05;
real h=0.001;
path carre = box ((0,0),(84a,84a)),
disque = scale(9a)*unitcircle,
patron1[] = shift(42a,42a)*disque,
patron2[] = shift(14a,70a)*disque^^shift(70a,14a)*disque,
patron3[] = shift(14a,70a)*disque^^shift(70a,14a)*disque^^shif t(42a,42a)*disque,
patron4[] = shift(14a,14a)*disque^^shift(14a,70a)*disque^^shif t(70a,14a)*disque^^shift(70a,70a)*disque,
patron5[] = shift(14a,14a)*disque^^shift(14a,70a)*disque^^shif t(70a,14a)*disque^^shift(70a,70a)*disque^^shift(42 a,42a)*disque,
patron6[] = shift(14a,14a)*disque^^shift(14a,70a)*disque^^shif t(70a,14a)*disque^^shift(70a,70a)*disque^^shift(42 a,70a)*disque^^shift(42a,14a)*disque;
transform3 tX=shift(-(84a+h)*X), tY=shift((84a+h)*Y), tZ=shift((84a+h)*Z);
path3 facegauche[] =shift(0,-h,0)*path3(patron6,ZXplane),
facedroite[] =path3(patron1,ZXplane),
faceavant[] =shift(h,0,0)*path3(patron2,YZplane),
facearriere[] =shift(-h,0,0)*path3(patron5,YZplane),
facehaut[] =path3(patron4,XYplane),
facebas[] =shift(0,0,-h)*path3(patron3,XYplane);
// draw(O--4.2X ^^ O--4.2Y ^^ O--4.2Z,red);
draw(tX*scale3(84a)*unitcube, surfacepen=lightolive);
draw(box(O, 84a*(-X+Y+Z)), palecyan);
draw(surface(tX*facegauche),darkmagenta);
draw(surface(tX*tY*facedroite),darkmagenta);
draw(surface(tX*tZ*facehaut),darkmagenta);
draw(surface(-tX*facebas),darkmagenta);
draw(surface(-tX*facearriere),darkmagenta);
draw(surface(faceavant),darkmagenta);
\end{asy}
\end{document}

Output:
2533

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?

Dark Photon
10-30-2017, 06:21 AM
So, how to install the glut library on windows?



http://freeglut.sourceforge.net/
http://freeglut.sourceforge.net/index.php#download


See "Prepackaged Releases" on the second link.