Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gl2ps
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dan
gl2ps
Commits
1fc94990
Commit
1fc94990
authored
20 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
nicer
parent
62133e0b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gl2psTestSimple.c
+22
-45
22 additions, 45 deletions
gl2psTestSimple.c
with
22 additions
and
45 deletions
gl2psTestSimple.c
+
22
−
45
View file @
1fc94990
/* $Id: gl2psTestSimple.c,v 1.
6
2005-0
1-01 19:16:53
geuzaine Exp $ */
/* $Id: gl2psTestSimple.c,v 1.
7
2005-0
6-19 18:56:47
geuzaine Exp $ */
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2005 Christophe Geuzaine <geuz@geuz.org>
...
...
@@ -49,43 +49,23 @@
#include
<string.h>
#include
"gl2ps.h"
static
float
rotation
=
-
60
.;
void
init
(
void
){
float
pos
[
4
]
=
{
1
.,
1
.,
-
1
.,
0
.};
glEnable
(
GL_DEPTH_TEST
);
glDepthFunc
(
GL_LESS
);
glShadeModel
(
GL_SMOOTH
);
glEnable
(
GL_LIGHT0
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
pos
);
}
void
display
(
void
){
int
i
;
char
*
help
=
"Press 's' to save image or 'q' to quit"
;
glClearColor
(
0
.
3
,
0
.
5
,
0
.
8
,
0
.);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glPushMatrix
();
glRotatef
(
-
60
.,
2
.,
0
.,
1
.);
glEnable
(
GL_LIGHTING
);
glRotatef
(
rotation
,
2
.,
0
.,
1
.);
/*
glBegin(GL_TRIANGLES);
glNormal3f(0,0,1);
glVertex3f(0,0,0);
glVertex3f(0.5,0,0);
glVertex3f(0.5,0.5,0);
glNormal3f(0,1,0);
glVertex3f(0,0,0);
glVertex3f(0.5,0,0);
glVertex3f(0.5,0,0.5);
glEnd();
*/
glutSolidTorus
(
0
.
3
,
0
.
6
,
30
,
30
);
/* glutSolidTeapot(0.7); */
glDisable
(
GL_LIGHTING
);
glPopMatrix
();
glColor3f
(
1
.,
1
.,
1
.);
glRasterPos2d
(
-
0
.
9
,
-
0
.
9
);
gl2psText
(
help
,
"Times-Roman"
,
24
);
for
(
i
=
0
;
i
<
strlen
(
help
);
i
++
)
glutBitmapCharacter
(
GLUT_BITMAP_TIMES_ROMAN_24
,
help
[
i
]);
glFlush
();
}
...
...
@@ -98,12 +78,10 @@ void keyboard(unsigned char key, int x, int y){
exit
(
0
);
break
;
case
's'
:
printf
(
"Writing file...
\n
"
);
fp
=
fopen
(
"test.eps"
,
"wb"
);
while
(
state
==
GL2PS_OVERFLOW
){
buffsize
+=
1024
*
1024
;
gl2psBeginPage
(
"test"
,
"test"
,
NULL
,
GL2PS_EPS
,
GL2PS_SIMPLE_SORT
/* GL2PS_BSP_SORT */
,
gl2psBeginPage
(
"test"
,
"test"
,
NULL
,
GL2PS_EPS
,
GL2PS_BSP_SORT
,
GL2PS_DRAW_BACKGROUND
|
GL2PS_USE_CURRENT_VIEWPORT
,
GL_RGBA
,
0
,
NULL
,
0
,
0
,
0
,
buffsize
,
fp
,
"test.eps"
);
display
();
...
...
@@ -115,23 +93,22 @@ void keyboard(unsigned char key, int x, int y){
}
}
void
motion
(
int
x
,
int
y
){
rotation
+=
10
.;
display
();
}
int
main
(
int
argc
,
char
**
argv
){
glutInit
(
&
argc
,
argv
);
glutInitDisplayMode
(
GLUT_SINGLE
|
GLUT_DEPTH
);
glutInitDisplayMode
(
GLUT_DEPTH
);
glutInitWindowSize
(
400
,
400
);
glutInitWindowPosition
(
100
,
100
);
glutCreateWindow
(
argv
[
0
]);
init
();
GLfloat
pos
[
4
]
=
{
1
.,
1
.,
-
1
.,
0
.};
glEnable
(
GL_DEPTH_TEST
);
glDepthFunc
(
GL_LESS
);
glShadeModel
(
GL_SMOOTH
);
glEnable
(
GL_LIGHT0
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
pos
);
glutDisplayFunc
(
display
);
glutKeyboardFunc
(
keyboard
);
glutMotionFunc
(
motion
);
printf
(
"Press 's' to save image or 'q' to quit
\n
"
);
glutMainLoop
();
return
0
;
...
...
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