Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
2d852f09
Commit
2d852f09
authored
22 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
And, finally, upgrade to the latest gl2ps
parent
e2169d38
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Graphics/gl2ps.cpp
+140
-91
140 additions, 91 deletions
Graphics/gl2ps.cpp
Graphics/gl2ps.h
+17
-17
17 additions, 17 deletions
Graphics/gl2ps.h
with
157 additions
and
108 deletions
Graphics/gl2ps.cpp
+
140
−
91
View file @
2d852f09
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-200
2
Christophe Geuzaine
* Copyright (C) 1999-200
3
Christophe Geuzaine
*
* $Id: gl2ps.cpp,v 1.5
8
2003-01-2
2 04:19
:4
4
geuzaine Exp $
* $Id: gl2ps.cpp,v 1.5
9
2003-01-2
3 20:23
:4
6
geuzaine Exp $
*
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
...
...
@@ -83,13 +83,14 @@ void gl2psListRealloc(GL2PSlist *list, GLint n){
list
->
nmax
=
((
n
-
1
)
/
list
->
incr
+
1
)
*
list
->
incr
;
list
->
array
=
(
char
*
)
gl2psMalloc
(
list
->
nmax
*
list
->
size
);
}
else
else
{
if
(
n
>
list
->
nmax
){
list
->
nmax
=
((
n
-
1
)
/
list
->
incr
+
1
)
*
list
->
incr
;
list
->
array
=
(
char
*
)
gl2psRealloc
(
list
->
array
,
list
->
nmax
*
list
->
size
);
}
}
}
GL2PSlist
*
gl2psListCreate
(
GLint
n
,
GLint
incr
,
GLint
size
){
GL2PSlist
*
list
;
...
...
@@ -122,8 +123,9 @@ GLint gl2psListNbr(GL2PSlist *list){
}
void
*
gl2psListPointer
(
GL2PSlist
*
list
,
GLint
index
){
if
((
index
<
0
)
||
(
index
>=
list
->
n
))
if
((
index
<
0
)
||
(
index
>=
list
->
n
))
{
gl2psMsg
(
GL2PS_ERROR
,
"Wrong list index in gl2psListPointer"
);
}
return
(
&
list
->
array
[
index
*
list
->
size
]);
}
...
...
@@ -136,17 +138,19 @@ void gl2psListAction(GL2PSlist *list,
void
(
*
action
)(
void
*
data
,
void
*
dummy
)){
GLint
i
,
dummy
;
for
(
i
=
0
;
i
<
gl2psListNbr
(
list
);
i
++
)
for
(
i
=
0
;
i
<
gl2psListNbr
(
list
);
i
++
)
{
(
*
action
)(
gl2psListPointer
(
list
,
i
),
&
dummy
);
}
}
void
gl2psListActionInverse
(
GL2PSlist
*
list
,
void
(
*
action
)(
void
*
data
,
void
*
dummy
)){
GLint
i
,
dummy
;
for
(
i
=
gl2psListNbr
(
list
);
i
>
0
;
i
--
)
for
(
i
=
gl2psListNbr
(
list
);
i
>
0
;
i
--
)
{
(
*
action
)(
gl2psListPointer
(
list
,
i
-
1
),
&
dummy
);
}
}
/* The 3D sorting routines */
...
...
@@ -173,6 +177,7 @@ GLfloat gl2psNorm(GLfloat *a){
void
gl2psGetNormal
(
GLfloat
*
a
,
GLfloat
*
b
,
GLfloat
*
c
){
GLfloat
norm
;
gl2psPvec
(
a
,
b
,
c
);
if
(
!
GL2PS_ZERO
(
norm
=
gl2psNorm
(
c
))){
c
[
0
]
=
c
[
0
]
/
norm
;
...
...
@@ -290,22 +295,24 @@ void gl2psCreateSplitPrimitive(GL2PSprimitive *parent, GL2PSplane plane,
child
->
verts
=
(
GL2PSvertex
*
)
gl2psMalloc
(
numverts
*
sizeof
(
GL2PSvertex
));
for
(
i
=
0
;
i
<
numverts
;
i
++
){
if
(
index1
[
i
]
<
0
)
if
(
index1
[
i
]
<
0
)
{
child
->
verts
[
i
]
=
parent
->
verts
[
index0
[
i
]];
else
}
else
{
gl2psCutEdge
(
&
parent
->
verts
[
index0
[
i
]],
&
parent
->
verts
[
index1
[
i
]],
plane
,
&
child
->
verts
[
i
]);
}
}
}
void
gl2psAddIndex
(
GLshort
*
index0
,
GLshort
*
index1
,
GLshort
*
nb
,
GLshort
i
,
GLshort
j
){
GLint
k
;
for
(
k
=
0
;
k
<
*
nb
;
k
++
)
for
(
k
=
0
;
k
<
*
nb
;
k
++
)
{
if
((
index0
[
k
]
==
i
&&
index1
[
k
]
==
j
)
||
(
index1
[
k
]
==
i
&&
index0
[
k
]
==
j
))
return
;
}
index0
[
*
nb
]
=
i
;
index1
[
*
nb
]
=
j
;
(
*
nb
)
++
;
...
...
@@ -324,8 +331,9 @@ GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane){
d
[
i
]
=
gl2psComparePointPlane
(
prim
->
verts
[
i
].
xyz
,
plane
);
}
if
(
prim
->
type
==
GL2PS_POINT
)
if
(
prim
->
type
==
GL2PS_POINT
)
{
return
0
;
}
else
{
for
(
i
=
0
;
i
<
prim
->
numverts
;
i
++
){
j
=
gl2psGetIndex
(
i
,
prim
->
numverts
);
...
...
@@ -432,13 +440,16 @@ int gl2psCompareDepth(const void *a, const void *b){
q
=
*
(
GL2PSprimitive
**
)
a
;
w
=
*
(
GL2PSprimitive
**
)
b
;
diff
=
q
->
depth
-
w
->
depth
;
if
(
diff
>
0.
)
if
(
diff
>
0.
)
{
return
1
;
else
if
(
diff
<
0.
)
}
else
if
(
diff
<
0.
){
return
-
1
;
else
}
else
{
return
0
;
}
}
int
gl2psTrianglesFirst
(
const
void
*
a
,
const
void
*
b
){
GL2PSprimitive
*
q
,
*
w
;
...
...
@@ -575,24 +586,27 @@ void gl2psBuildBspTree(GL2PSbsptree *tree, GL2PSlist *primitives){
}
}
if
(
gl2psListNbr
(
tree
->
primitives
))
if
(
gl2psListNbr
(
tree
->
primitives
))
{
gl2psListSort
(
tree
->
primitives
,
gl2psTrianglesFirst
);
}
if
(
gl2psListNbr
(
frontlist
)){
gl2psListSort
(
frontlist
,
gl2psTrianglesFirst
);
tree
->
front
=
(
GL2PSbsptree
*
)
gl2psMalloc
(
sizeof
(
GL2PSbsptree
));
gl2psBuildBspTree
(
tree
->
front
,
frontlist
);
}
else
else
{
gl2psListDelete
(
frontlist
);
}
if
(
gl2psListNbr
(
backlist
)){
gl2psListSort
(
backlist
,
gl2psTrianglesFirst
);
tree
->
back
=
(
GL2PSbsptree
*
)
gl2psMalloc
(
sizeof
(
GL2PSbsptree
));
gl2psBuildBspTree
(
tree
->
back
,
backlist
);
}
else
else
{
gl2psListDelete
(
backlist
);
}
gl2psListDelete
(
primitives
);
}
...
...
@@ -626,6 +640,7 @@ void gl2psTraverseBspTree(GL2PSbsptree *tree, GL2PSxyz eye, GLfloat epsilon,
GLint
gl2psGetPlaneFromPoints
(
GL2PSxyz
a
,
GL2PSxyz
b
,
GL2PSplane
plane
){
GLfloat
n
;
plane
[
0
]
=
b
[
1
]
-
a
[
1
];
plane
[
1
]
=
a
[
0
]
-
b
[
0
];
n
=
sqrt
(
plane
[
0
]
*
plane
[
0
]
+
plane
[
1
]
*
plane
[
1
]);
...
...
@@ -655,6 +670,7 @@ void gl2psFreeBspImageTree(GL2PSbsptree2d **tree){
GLint
gl2psCheckPoint
(
GL2PSxyz
point
,
GL2PSplane
plane
){
GLfloat
pt_dis
;
pt_dis
=
gl2psComparePointPlane
(
point
,
plane
);
if
(
pt_dis
>
GL2PS_EPSILON
)
return
GL2PS_POINT_INFRONT
;
else
if
(
pt_dis
<
-
GL2PS_EPSILON
)
return
GL2PS_POINT_BACK
;
...
...
@@ -674,14 +690,17 @@ void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
if
(
!
gl2psGetPlaneFromPoints
(
prim
->
verts
[
i
].
xyz
,
prim
->
verts
[
i
+
1
].
xyz
,
head
->
plane
)){
if
(
prim
->
numverts
-
i
>
3
)
if
(
prim
->
numverts
-
i
>
3
)
{
offset
++
;
}
else
{
gl2psFree
(
head
);
return
;
}
}
else
break
;
else
{
break
;
}
}
head
->
back
=
NULL
;
head
->
front
=
NULL
;
...
...
@@ -693,8 +712,9 @@ void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
case
GL2PS_POINT_INFRONT
:
cur
=
head
;
for
(
i
=
1
+
offset
;
i
<
prim
->
numverts
-
1
;
i
++
){
if
(
cur
->
front
==
NULL
)
if
(
cur
->
front
==
NULL
)
{
cur
->
front
=
(
GL2PSbsptree2d
*
)
gl2psMalloc
(
sizeof
(
GL2PSbsptree2d
));
}
if
(
gl2psGetPlaneFromPoints
(
prim
->
verts
[
i
].
xyz
,
prim
->
verts
[
i
+
1
].
xyz
,
cur
->
front
->
plane
)){
...
...
@@ -703,8 +723,9 @@ void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
cur
->
back
=
NULL
;
}
}
if
(
cur
->
front
==
NULL
)
if
(
cur
->
front
==
NULL
)
{
cur
->
front
=
(
GL2PSbsptree2d
*
)
gl2psMalloc
(
sizeof
(
GL2PSbsptree2d
));
}
if
(
gl2psGetPlaneFromPoints
(
prim
->
verts
[
i
].
xyz
,
prim
->
verts
[
offset
].
xyz
,
cur
->
front
->
plane
)){
...
...
@@ -717,12 +738,14 @@ void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
}
break
;
case
GL2PS_POINT_BACK
:
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
{
head
->
plane
[
i
]
=
-
head
->
plane
[
i
];
}
cur
=
head
;
for
(
i
=
1
+
offset
;
i
<
prim
->
numverts
-
1
;
i
++
){
if
(
cur
->
front
==
NULL
)
if
(
cur
->
front
==
NULL
)
{
cur
->
front
=
(
GL2PSbsptree2d
*
)
gl2psMalloc
(
sizeof
(
GL2PSbsptree2d
));
}
if
(
gl2psGetPlaneFromPoints
(
prim
->
verts
[
i
+
1
].
xyz
,
prim
->
verts
[
i
].
xyz
,
cur
->
front
->
plane
)){
...
...
@@ -731,8 +754,9 @@ void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
cur
->
back
=
NULL
;
}
}
if
(
cur
->
front
==
NULL
)
if
(
cur
->
front
==
NULL
)
{
cur
->
front
=
(
GL2PSbsptree2d
*
)
gl2psMalloc
(
sizeof
(
GL2PSbsptree2d
));
}
if
(
gl2psGetPlaneFromPoints
(
prim
->
verts
[
offset
].
xyz
,
prim
->
verts
[
i
].
xyz
,
cur
->
front
->
plane
)){
...
...
@@ -755,6 +779,7 @@ void gl2psAddPlanesInBspTreeImage(GL2PSprimitive *prim,
GLint
gl2psCheckPrimitive
(
GL2PSprimitive
*
prim
,
GL2PSplane
plane
){
GLint
i
;
GLint
pos
;
pos
=
gl2psCheckPoint
(
prim
->
verts
[
0
].
xyz
,
plane
);
for
(
i
=
1
;
i
<
prim
->
numverts
;
i
++
){
pos
|=
gl2psCheckPoint
(
prim
->
verts
[
i
].
xyz
,
plane
);
...
...
@@ -770,6 +795,7 @@ GL2PSprimitive* gl2psCreateSplitPrimitive2D(GL2PSprimitive *parent,
GL2PSvertex
*
vertx
){
GLint
i
;
GL2PSprimitive
*
child
=
(
GL2PSprimitive
*
)
gl2psMalloc
(
sizeof
(
GL2PSprimitive
));
switch
(
numverts
){
case
1
:
child
->
type
=
GL2PS_POINT
;
break
;
case
2
:
child
->
type
=
GL2PS_LINE
;
break
;
...
...
@@ -783,8 +809,9 @@ GL2PSprimitive* gl2psCreateSplitPrimitive2D(GL2PSprimitive *parent,
child
->
width
=
parent
->
width
;
child
->
numverts
=
numverts
;
child
->
verts
=
(
GL2PSvertex
*
)
gl2psMalloc
(
numverts
*
sizeof
(
GL2PSvertex
));
for
(
i
=
0
;
i
<
numverts
;
i
++
)
for
(
i
=
0
;
i
<
numverts
;
i
++
)
{
child
->
verts
[
i
]
=
vertx
[
i
];
}
return
child
;
}
...
...
@@ -816,9 +843,10 @@ void gl2psSplitPrimitive2D(GL2PSprimitive *prim,
}
else
if
(
flag
){
cur
=
gl2psCheckPoint
(
prim
->
verts
[
v1
].
xyz
,
plane
);
if
(
i
==
0
)
if
(
i
==
0
)
{
prev0
=
cur
;
}
}
if
(((
prev
==
-
1
)
||
(
prev
==
cur
)
||
(
prev
==
0
)
||
(
cur
==
0
))
&&
(
i
<
prim
->
numverts
)){
if
(
cur
==
GL2PS_POINT_INFRONT
){
...
...
@@ -888,9 +916,11 @@ GLint gl2psAddInImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
case
GL2PS_SPANNING
:
gl2psSplitPrimitive2D
(
prim
,
(
*
tree
)
->
plane
,
&
frontprim
,
&
backprim
);
ret
=
gl2psAddInImageTree
(
backprim
,
&
(
*
tree
)
->
back
);
if
((
*
tree
)
->
front
!=
NULL
)
if
(
gl2psAddInImageTree
(
frontprim
,
&
(
*
tree
)
->
front
))
if
((
*
tree
)
->
front
!=
NULL
)
{
if
(
gl2psAddInImageTree
(
frontprim
,
&
(
*
tree
)
->
front
))
{
ret
=
1
;
}
}
gl2psFree
(
frontprim
->
verts
);
gl2psFree
(
frontprim
);
gl2psFree
(
backprim
->
verts
);
...
...
@@ -905,8 +935,8 @@ GLint gl2psAddInImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
}
void
gl2psAddInImage
(
void
*
a
,
void
*
b
){
GL2PSprimitive
*
prim
;
prim
=
*
(
GL2PSprimitive
**
)
a
;
GL2PSprimitive
*
prim
=
*
(
GL2PSprimitive
**
)
a
;
if
(
!
gl2psAddInImageTree
(
prim
,
&
gl2ps
->
image
)){
prim
->
culled
=
1
;
}
...
...
@@ -1069,8 +1099,9 @@ void gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
prim
->
depth
=
0.
;
if
(
gl2ps
->
sort
==
GL2PS_SIMPLE_SORT
){
for
(
i
=
0
;
i
<
numverts
;
i
++
)
for
(
i
=
0
;
i
<
numverts
;
i
++
)
{
prim
->
depth
+=
prim
->
verts
[
i
].
xyz
[
2
];
}
prim
->
depth
/=
(
GLfloat
)
numverts
;
}
...
...
@@ -1226,9 +1257,12 @@ GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2){
GLboolean
gl2psVertsSameColor
(
const
GL2PSprimitive
*
prim
){
int
i
;
for
(
i
=
1
;
i
<
prim
->
numverts
;
i
++
)
if
(
!
gl2psSameColor
(
prim
->
verts
[
0
].
rgba
,
prim
->
verts
[
i
].
rgba
))
for
(
i
=
1
;
i
<
prim
->
numverts
;
i
++
){
if
(
!
gl2psSameColor
(
prim
->
verts
[
0
].
rgba
,
prim
->
verts
[
i
].
rgba
)){
return
0
;
}
}
return
1
;
}
...
...
@@ -1246,12 +1280,15 @@ void gl2psPrintPostScriptHeader(void){
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
if
(
gl2ps
->
format
==
GL2PS_PS
)
if
(
gl2ps
->
format
==
GL2PS_PS
)
{
fprintf
(
gl2ps
->
stream
,
"%%!PS-Adobe-3.0
\n
"
);
else
if
(
gl2ps
->
format
==
GL2PS_EPS
)
}
else
if
(
gl2ps
->
format
==
GL2PS_EPS
){
fprintf
(
gl2ps
->
stream
,
"%%!PS-Adobe-3.0 EPSF-3.0
\n
"
);
else
}
else
{
gl2psMsg
(
GL2PS_ERROR
,
"Unknown PostScript format"
);
}
fprintf
(
gl2ps
->
stream
,
"%%%%Title: %s
\n
"
...
...
@@ -1263,17 +1300,18 @@ void gl2psPrintPostScriptHeader(void){
"%%%%Pages: 1
\n
"
,
gl2ps
->
title
,
GL2PS_VERSION
,
gl2ps
->
producer
,
ctime
(
&
now
));
if
(
gl2ps
->
format
==
GL2PS_PS
)
if
(
gl2ps
->
format
==
GL2PS_PS
)
{
fprintf
(
gl2ps
->
stream
,
"%%%%Orientation: %s
\n
"
"%%%%DocumentMedia: Default %d %d 0 () ()
\n
"
,
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
?
"Landscape"
:
"Portrait"
,
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
?
viewport
[
3
]
:
viewport
[
2
],
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
?
viewport
[
2
]
:
viewport
[
3
]);
}
fprintf
(
gl2ps
->
stream
,
"%%%%BoundingBox: %d %d %d %d
\n
"
"%%%%Copyright: GNU LGPL (C) 1999-200
2
Christophe Geuzaine <geuz@geuz.org>
\n
"
"%%%%Copyright: GNU LGPL (C) 1999-200
3
Christophe Geuzaine <geuz@geuz.org>
\n
"
"%%%%EndComments
\n
"
,
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
?
viewport
[
1
]
:
viewport
[
0
],
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
?
viewport
[
0
]
:
viewport
[
1
],
...
...
@@ -1421,10 +1459,11 @@ void gl2psPrintPostScriptHeader(void){
"%%%%Page: 1 1
\n
"
"%%%%BeginPageSetup
\n
"
);
if
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
if
(
gl2ps
->
options
&
GL2PS_LANDSCAPE
)
{
fprintf
(
gl2ps
->
stream
,
"%d 0 translate 90 rotate
\n
"
,
viewport
[
3
]);
}
fprintf
(
gl2ps
->
stream
,
"%%%%EndPageSetup
\n
"
...
...
@@ -1433,8 +1472,9 @@ void gl2psPrintPostScriptHeader(void){
"1.0 1.0 scale
\n
"
);
if
(
gl2ps
->
options
&
GL2PS_DRAW_BACKGROUND
){
if
(
gl2ps
->
colormode
==
GL_RGBA
||
gl2ps
->
colorsize
==
0
)
if
(
gl2ps
->
colormode
==
GL_RGBA
||
gl2ps
->
colorsize
==
0
)
{
glGetFloatv
(
GL_COLOR_CLEAR_VALUE
,
rgba
);
}
else
{
glGetIntegerv
(
GL_INDEX_CLEAR_VALUE
,
&
index
);
rgba
[
0
]
=
gl2ps
->
colormap
[
index
][
0
];
...
...
@@ -1489,8 +1529,9 @@ void gl2psPrintPostScriptPrimitive(void *a, void *b){
gl2ps
->
lastlinewidth
=
prim
->
width
;
fprintf
(
gl2ps
->
stream
,
"%g W
\n
"
,
gl2ps
->
lastlinewidth
);
}
if
(
prim
->
dash
)
if
(
prim
->
dash
)
{
fprintf
(
gl2ps
->
stream
,
"[%d] 0 setdash
\n
"
,
prim
->
dash
);
}
if
(
gl2ps
->
shade
&&
!
gl2psVertsSameColor
(
prim
)){
gl2psResetPostScriptColor
();
fprintf
(
gl2ps
->
stream
,
"%g %g %g %g %g %g %g %g %g %g SL
\n
"
,
...
...
@@ -1506,8 +1547,9 @@ void gl2psPrintPostScriptPrimitive(void *a, void *b){
prim
->
verts
[
1
].
xyz
[
0
],
prim
->
verts
[
1
].
xyz
[
1
],
prim
->
verts
[
0
].
xyz
[
0
],
prim
->
verts
[
0
].
xyz
[
1
]);
}
if
(
prim
->
dash
)
if
(
prim
->
dash
)
{
fprintf
(
gl2ps
->
stream
,
"[] 0 setdash
\n
"
);
}
break
;
case
GL2PS_TRIANGLE
:
if
(
gl2ps
->
shade
&&
!
gl2psVertsSameColor
(
prim
)){
...
...
@@ -1569,8 +1611,9 @@ void gl2psPrintTeXHeader(void){
}
if
(
i
<=
0
)
strcpy
(
name
,
gl2ps
->
filename
);
}
else
else
{
strcpy
(
name
,
"untitled"
);
}
fprintf
(
gl2ps
->
stream
,
"
\\
setlength{
\\
unitlength}{1pt}
\n
"
...
...
@@ -1637,8 +1680,9 @@ GL2PSDLL_API void gl2psBeginPage(const char *title, const char *producer,
gl2ps
->
colormap
=
NULL
;
}
else
if
(
gl2ps
->
colormode
==
GL_COLOR_INDEX
){
if
(
!
colorsize
||
!
colormap
)
if
(
!
colorsize
||
!
colormap
)
{
gl2psMsg
(
GL2PS_ERROR
,
"Missing colormap for GL_COLOR_INDEX rendering"
);
}
gl2ps
->
colorsize
=
colorsize
;
gl2ps
->
colormap
=
(
GL2PSrgba
*
)
gl2psMalloc
(
gl2ps
->
colorsize
*
sizeof
(
GL2PSrgba
));
memcpy
(
gl2ps
->
colormap
,
colormap
,
gl2ps
->
colorsize
*
sizeof
(
GL2PSrgba
));
...
...
@@ -1646,10 +1690,12 @@ GL2PSDLL_API void gl2psBeginPage(const char *title, const char *producer,
else
gl2psMsg
(
GL2PS_ERROR
,
"Unknown color mode in gl2psBeginPage"
);
if
(
stream
)
if
(
stream
)
{
gl2ps
->
stream
=
stream
;
else
}
else
{
gl2psMsg
(
GL2PS_ERROR
,
"Bad file pointer"
);
}
glFeedbackBuffer
(
gl2ps
->
buffersize
,
GL_3D_COLOR
,
gl2ps
->
feedback
);
glRenderMode
(
GL_FEEDBACK
);
...
...
@@ -1663,16 +1709,19 @@ GL2PSDLL_API GLint gl2psEndPage(void){
void
(
*
pprim
)(
void
*
a
,
void
*
b
)
=
0
;
void
(
*
pfoot
)(
void
)
=
0
;
if
(
!
gl2ps
)
if
(
!
gl2ps
)
{
gl2psMsg
(
GL2PS_ERROR
,
"Uninitialized gl2ps context"
);
}
glGetIntegerv
(
GL_SHADE_MODEL
,
&
shademodel
);
gl2ps
->
shade
=
(
shademodel
==
GL_SMOOTH
);
if
(
gl2ps
->
format
==
GL2PS_TEX
)
if
(
gl2ps
->
format
==
GL2PS_TEX
)
{
res
=
GL2PS_SUCCESS
;
else
}
else
{
res
=
gl2psParseFeedbackBuffer
();
}
if
(
gl2ps
->
feedback
)
gl2psFree
(
gl2ps
->
feedback
);
...
...
This diff is collapsed.
Click to expand it.
Graphics/gl2ps.h
+
17
−
17
View file @
2d852f09
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-200
2
Christophe Geuzaine
* Copyright (C) 1999-200
3
Christophe Geuzaine
*
* $Id: gl2ps.h,v 1.3
3
2003-01-2
2 02:35
:4
7
geuzaine Exp $
* $Id: gl2ps.h,v 1.3
4
2003-01-2
3 20:23
:4
6
geuzaine Exp $
*
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
...
...
@@ -40,19 +40,19 @@
# define GL2PSDLL_API __declspec(dllexport)
# else
# define GL2PSDLL_API __declspec(dllimport)
#endif
/* GL2PSDLL_EXPORTS */
#
endif
# else
# define GL2PSDLL_API
#endif
/* GL2PSDLL */
#
endif
#else
# define GL2PSDLL_API
#endif
/* WIN32 */
#endif
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
/* __APPLE__ */
#endif
#define GL2PS_VERSION 0.72
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment