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
ce89c1fb
Commit
ce89c1fb
authored
22 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Update to 0.8
parent
b95d4510
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Graphics/gl2ps.cpp
+80
-78
80 additions, 78 deletions
Graphics/gl2ps.cpp
Graphics/gl2ps.h
+1
-1
1 addition, 1 deletion
Graphics/gl2ps.h
with
81 additions
and
79 deletions
Graphics/gl2ps.cpp
+
80
−
78
View file @
ce89c1fb
...
...
@@ -2,7 +2,7 @@
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2003 Christophe Geuzaine
*
* $Id: gl2ps.cpp,v 1.6
2
2003-03-
07 18:53:21
geuzaine Exp $
* $Id: gl2ps.cpp,v 1.6
3
2003-03-
10 16:21:38
geuzaine Exp $
*
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
...
...
@@ -30,7 +30,7 @@
#include
"gl2ps.h"
/* The gl2ps context. gl2ps is not thread safe (we should create a
local GL2PScontext during gl2psBeginPage)
.
*/
local GL2PScontext during gl2psBeginPage) */
GL2PScontext
*
gl2ps
=
NULL
;
...
...
@@ -50,9 +50,7 @@ void gl2psMsg(GLint level, char *fmt, ...){
va_end
(
args
);
fprintf
(
stderr
,
"
\n
"
);
}
/*
if(level == GL2PS_ERROR) exit(1);
*/
/* if(level == GL2PS_ERROR) exit(1); */
}
void
*
gl2psMalloc
(
size_t
size
){
...
...
@@ -197,9 +195,9 @@ void gl2psGetNormal(GLfloat *a, GLfloat *b, GLfloat *c){
c
[
2
]
=
c
[
2
]
/
norm
;
}
else
{
/*
T
he plane is still wrong, despite our tests in
gl2psGetPlane... Let's return a dummy value (this is a
hack: we
should do more tests in GetPlane)
:
*/
/*
FIXME: t
he plane is still wrong, despite our tests in
gl2psGetPlane... Let's return a dummy value
for now
(this is a
hack: we
should do more tests in GetPlane) */
c
[
0
]
=
c
[
1
]
=
0.
;
c
[
2
]
=
1.
;
}
...
...
@@ -840,17 +838,17 @@ void gl2psSplitPrimitive2D(GL2PSprimitive *prim,
GL2PSprimitive
**
front
,
GL2PSprimitive
**
back
){
/* cur will hold the position of current vertex
prev will hold
s
the position of previous vertex
prev0 will hold
s
the position of vertex number 0
v1 and v2 represent the current and previous vert
exs
respectively
flag
will represents that should the current
be checked against the plane */
/* cur will hold the position of
the
current vertex
prev will hold the position of
the
previous vertex
prev0 will hold the position of
the
vertex number 0
v1 and v2 represent the current and previous vert
ices,
respectively
flag
is set if the current vertex should
be checked against the plane */
GLint
cur
=
-
1
,
prev
=
-
1
,
i
,
v1
=
0
,
v2
=
0
,
flag
=
1
,
prev0
=
-
1
;
/* list of vert
exs which
will go in front and back
P
rimitive */
/* list of vert
ices that
will go in front and back
p
rimitive */
GL2PSvertex
*
front_list
=
NULL
,
*
back_list
=
NULL
;
/* number of vert
ex
in front and back list */
/* number of vert
ices
in front and back list */
GLint
front_count
=
0
,
back_count
=
0
;
for
(
i
=
0
;
i
<=
prim
->
numverts
;
i
++
){
...
...
@@ -923,6 +921,13 @@ GLint gl2psAddInBspImageTree(GL2PSprimitive *prim, GL2PSbsptree2d **tree){
GLint
ret
=
0
;
GL2PSprimitive
*
frontprim
=
NULL
,
*
backprim
=
NULL
;
/* FIXME: until we consider the actual extent of text strings and
pixmaps, never cull them. Otherwise the whole string/pixmap gets
culled as soon as the reference point is hidden */
if
(
prim
->
type
==
GL2PS_PIXMAP
||
prim
->
type
==
GL2PS_TEXT
){
return
1
;
}
if
(
*
tree
==
NULL
){
gl2psAddPlanesInBspTreeImage
(
prim
,
tree
);
return
1
;
...
...
@@ -982,14 +987,14 @@ void gl2psAddBoundaryInList(GL2PSprimitive *prim, GL2PSlist *list){
b
=
(
GL2PSprimitive
*
)
gl2psMalloc
(
sizeof
(
GL2PSprimitive
));
b
->
type
=
GL2PS_LINE
;
b
->
dash
=
prim
->
dash
;
b
->
depth
=
prim
->
depth
;
/* this is wrong */
b
->
depth
=
prim
->
depth
;
/*
FIXME:
this is wrong */
b
->
culled
=
prim
->
culled
;
b
->
width
=
prim
->
width
;
b
->
boundary
=
0
;
b
->
numverts
=
2
;
b
->
verts
=
(
GL2PSvertex
*
)
gl2psMalloc
(
2
*
sizeof
(
GL2PSvertex
));
#if 0 /* need to work on boundary offset... */
#if 0 /*
FIXME:
need to work on boundary offset... */
v[0] = c[0] - prim->verts[i].xyz[0];
v[1] = c[1] - prim->verts[i].xyz[1];
v[2] = 0.;
...
...
@@ -1080,7 +1085,7 @@ void gl2psAddPolyPrimitive(GLshort type, GLshort numverts,
}
else
if
(
offset
&&
type
==
GL2PS_TRIANGLE
){
/*
T
his needs some more work... */
/*
FIXME: t
his needs some more work... */
if
(
gl2ps
->
sort
==
GL2PS_SIMPLE_SORT
){
factor
=
gl2ps
->
offset
[
0
];
...
...
@@ -1286,8 +1291,6 @@ GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim){
return
1
;
}
GLint
gl2psPrintPrimitives
(
void
);
/* The PostScript routines. Other (vector) image formats should be
easy to generate by creating the three corresponding routines
(gl2psPrintXXXHeader, gl2psPrintXXXPrimitive, gl2psPrintXXXFooter,
...
...
@@ -1319,7 +1322,7 @@ void gl2psPrintPostScriptPixmap(GLfloat x, GLfloat y, GLsizei width, GLsizei hei
unsigned
int
row
,
col
,
col_max
;
float
dr
,
dg
,
db
,
fgrey
;
Uchar
red
,
green
,
blue
,
b
,
grey
;
/*
Options
*/
/*
FIXME: this has to be generalized...
*/
int
shade
=
0
;
int
nbit
=
4
;
...
...
@@ -1704,7 +1707,7 @@ void gl2psPrintPostScriptPrimitive(void *a, void *b){
prim
=
*
(
GL2PSprimitive
**
)
a
;
if
(
gl2ps
->
options
&
GL2PS_OCCLUSION_CULL
&&
prim
->
culled
)
return
;
if
(
(
gl2ps
->
options
&
GL2PS_OCCLUSION_CULL
)
&&
prim
->
culled
)
return
;
switch
(
prim
->
type
){
case
GL2PS_PIXMAP
:
...
...
@@ -1830,6 +1833,7 @@ void gl2psPrintPostScriptBeginViewport(GLint viewport[4]){
GLint
gl2psPrintPostScriptEndViewport
(
void
){
GLint
res
;
GLint
gl2psPrintPrimitives
(
void
);
res
=
gl2psPrintPrimitives
();
fprintf
(
gl2ps
->
stream
,
"grestore
\n
"
);
...
...
@@ -1898,20 +1902,19 @@ GLint gl2psPrintTeXEndViewport(void){
GLint
gl2psPrintPrimitives
(
void
){
GL2PSbsptree
*
root
;
GL2PSxyz
eye
=
{
0.
,
0.
,
100000.
};
GLint
shademodel
,
res
;
GLint
shademodel
,
res
=
GL2PS_SUCCESS
;
void
(
*
pprim
)(
void
*
a
,
void
*
b
)
=
0
;
glGetIntegerv
(
GL_SHADE_MODEL
,
&
shademodel
);
gl2ps
->
shade
=
(
shademodel
==
GL_SMOOTH
);
if
(
gl2ps
->
format
==
GL2PS_TEX
){
res
=
GL2PS_SUCCESS
;
}
else
{
if
(
gl2ps
->
format
==
GL2PS_PS
||
gl2ps
->
format
==
GL2PS_EPS
){
res
=
gl2psParseFeedbackBuffer
();
}
if
(
res
==
GL2PS_SUCCESS
){
if
(
res
!=
GL2PS_SUCCESS
){
return
res
;
}
switch
(
gl2ps
->
format
){
case
GL2PS_TEX
:
...
...
@@ -1962,9 +1965,8 @@ GLint gl2psPrintPrimitives(void){
res
=
GL2PS_ERROR
;
break
;
}
fflush
(
gl2ps
->
stream
);
}
fflush
(
gl2ps
->
stream
);
return
res
;
}
...
...
@@ -2205,7 +2207,7 @@ GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
prim
->
image
->
height
=
height
;
prim
->
image
->
format
=
format
;
prim
->
image
->
type
=
type
;
size
=
height
*
width
*
3
*
sizeof
(
GLfloat
);
/* FIXME:
generalize to
other types/formats */
size
=
height
*
width
*
3
*
sizeof
(
GLfloat
);
/* FIXME:
handle
other types/formats */
prim
->
image
->
pixels
=
(
GLfloat
*
)
gl2psMalloc
(
size
);
memcpy
(
prim
->
image
->
pixels
,
pixels
,
size
);
...
...
This diff is collapsed.
Click to expand it.
Graphics/gl2ps.h
+
1
−
1
View file @
ce89c1fb
...
...
@@ -2,7 +2,7 @@
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2003 Christophe Geuzaine
*
* $Id: gl2ps.h,v 1.3
7
2003-03-
07 18:53:21
geuzaine Exp $
* $Id: gl2ps.h,v 1.3
8
2003-03-
10 16:21:38
geuzaine Exp $
*
* E-mail: geuz@geuz.org
* URL: http://www.geuz.org/gl2ps/
...
...
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