summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/tr.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-27 22:27:57 +0000
committerKarl Berry <karl@freefriends.org>2019-03-27 22:27:57 +0000
commit9121faed0cf54a08882acf41120cf28fc3a32998 (patch)
treefe7f0c5e9ed02fe4a1fc389c27c88750c2807e43 /Build/source/utils/asymptote/tr.cc
parentb8e24fbf964b4030f68a8484a53d405869693266 (diff)
asy 2.48 sources
git-svn-id: svn://tug.org/texlive/trunk@50622 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/tr.cc')
-rw-r--r--Build/source/utils/asymptote/tr.cc71
1 files changed, 11 insertions, 60 deletions
diff --git a/Build/source/utils/asymptote/tr.cc b/Build/source/utils/asymptote/tr.cc
index 69041a5f80b..4408f4f219a 100644
--- a/Build/source/utils/asymptote/tr.cc
+++ b/Build/source/utils/asymptote/tr.cc
@@ -55,10 +55,8 @@
#endif
#ifdef __APPLE__
#include <OpenGL/gl.h>
-#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
-#include <GL/glu.h>
#endif
#include "tr.h"
@@ -66,6 +64,15 @@
#define DEFAULT_TILE_HEIGHT 256
#define DEFAULT_TILE_BORDER 0
+namespace gl {
+void frustum(GLdouble left, GLdouble right, GLdouble bottom,
+ GLdouble top, GLdouble nearVal, GLdouble farVal);
+void ortho(GLdouble left, GLdouble right, GLdouble bottom,
+ GLdouble top, GLdouble nearVal, GLdouble farVal);
+}
+
+using gl::frustum;
+using gl::ortho;
struct _TRctx {
/* Final image parameters */
@@ -362,9 +369,9 @@ void trBeginTile(TRcontext *tr)
top = bottom + (tr->Top - tr->Bottom) * tileHeight / tr->ImageHeight;
if (tr->Perspective)
- glFrustum(left, right, bottom, top, tr->Near, tr->Far);
+ frustum(left, right, bottom, top, tr->Near, tr->Far);
else
- glOrtho(left, right, bottom, top, tr->Near, tr->Far);
+ ortho(left, right, bottom, top, tr->Near, tr->Far);
/* restore user's matrix mode */
glMatrixMode(matrixMode);
@@ -437,60 +444,4 @@ int trEndTile(TRcontext *tr)
return 1;
}
-
-/*
- * Replacement for glRastePos3f() which avoids the problem with invalid
- * raster pos.
- */
-void trRasterPos3f(TRcontext *tr, GLfloat x, GLfloat y, GLfloat z)
-{
- if (tr->CurrentTile<0) {
- /* not doing tile rendering right now. Let OpenGL do this. */
- glRasterPos3f(x, y, z);
- }
- else {
- GLdouble modelview[16], proj[16];
- GLint viewport[4];
- GLdouble winX, winY, winZ;
-
- /* Get modelview, projection and viewport */
- glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
- glGetDoublev(GL_PROJECTION_MATRIX, proj);
- viewport[0] = 0;
- viewport[1] = 0;
- viewport[2] = tr->CurrentTileWidth;
- viewport[3] = tr->CurrentTileHeight;
-
- /* Project object coord to window coordinate */
- if (gluProject(x, y, z, modelview, proj, viewport, &winX, &winY, &winZ)){
-
- /* set raster pos to window coord (0,0) */
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0.0, tr->CurrentTileWidth,
- 0.0, tr->CurrentTileHeight, 0.0, 1.0);
- glRasterPos3f(0.0, 0.0, -winZ);
-
- /* Now use empty bitmap to adjust raster position to (winX,winY) */
- {
- GLubyte bitmap[1] = {0};
- glBitmap(1, 1, 0.0, 0.0, winX, winY, bitmap);
- }
-
- /* restore original matrices */
- glPopMatrix(); /*proj*/
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- }
-#ifdef DEBUG
- if (glGetError())
- printf("GL error!\n");
-#endif
- }
-}
-
#endif