summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-09-16 19:32:49 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-09-16 19:32:49 +0000
commit6fedd4e3bfb854f7de636f6ace2d19abb4a46fb5 (patch)
tree42c3e8c6c7c63587434288899b708622346debed
parentb18715fea310978683ba8eacdfcef6f746d0b2c4 (diff)
clean-up the hokey transformation code so that window resizes actually work
-rw-r--r--progs/demos/spriteblast.c44
1 files changed, 13 insertions, 31 deletions
diff --git a/progs/demos/spriteblast.c b/progs/demos/spriteblast.c
index 4e1d86cdd08..63dc7d12bb8 100644
--- a/progs/demos/spriteblast.c
+++ b/progs/demos/spriteblast.c
@@ -36,7 +36,6 @@
static GLfloat angle = -150; /* in degrees */
static int spin = 0;
static int moving, begin;
-static int newModel = 1;
static float theTime;
static int repeat = 1;
static int blend = 1;
@@ -183,7 +182,6 @@ idle(void)
updatePointList();
if (spin) {
angle += 0.3;
- newModel = 1;
}
glutPostRedisplay();
}
@@ -201,22 +199,15 @@ visible(int vis)
}
static void
-recalcModelView(void)
-{
- glPopMatrix();
- glPushMatrix();
- glRotatef(angle, 0.0, 1.0, 0.0);
- newModel = 0;
-}
-
-static void
redraw(void)
{
int i;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- if (newModel)
- recalcModelView();
+
+ glPushMatrix();
+ glRotatef(15.0, 1.0, 0.0, 0.0);
+ glRotatef(angle, 0.0, 1.0, 0.0);
glDepthMask(GL_FALSE);
@@ -264,6 +255,8 @@ redraw(void)
#endif
glDisable(GL_BLEND);
+ glPopMatrix();
+
glutSwapBuffers();
}
@@ -289,7 +282,6 @@ mouseMotion(int x, int y)
if (moving) {
angle = angle + (x - begin);
begin = x;
- newModel = 1;
glutPostRedisplay();
}
}
@@ -301,7 +293,7 @@ menu(int option)
case 0:
makePointList();
break;
-#if GL_ARB_point_parameters
+#ifdef GL_ARB_point_parameters
case 1:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
break;
@@ -318,7 +310,7 @@ menu(int option)
case 5:
blend = 0;
break;
-#if GL_ARB_point_parameters
+#ifdef GL_ARB_point_parameters
case 6:
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
break;
@@ -390,8 +382,8 @@ key(unsigned char c, int x, int y)
case 'o':
case 'O':
org ^= 1;
-#if GL_VERSION_2_0
-#if GL_ARB_point_parameters
+#ifdef GL_VERSION_2_0
+#ifdef GL_ARB_point_parameters
glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,
org ? GL_LOWER_LEFT : GL_UPPER_LEFT);
#endif
@@ -485,10 +477,10 @@ reshape(int width, int height)
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 2.0, 20.0);
+ glFrustum(-1.0, 1.0, -h, h, 2.0, 30.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef(0.0, 0.0, -60.0);
+ glTranslatef(0.0, 0.0, -10.0);
}
int
@@ -544,19 +536,9 @@ main(int argc, char **argv)
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(16.0);
-#if GL_ARB_point_parameters
+#ifdef GL_ARB_point_parameters
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif
- glMatrixMode(GL_PROJECTION);
- gluPerspective( /* field of view in degree */ 40.0,
- /* aspect ratio */ 1.0,
- /* Z near */ 0.5, /* Z far */ 40.0);
- glMatrixMode(GL_MODELVIEW);
- gluLookAt(0.0, 1.0, 8.0, /* eye location */
- 0.0, 1.0, 0.0, /* center is at (0,0,0) */
- 0.0, 1.0, 0.); /* up is in postivie Y direction */
- glPushMatrix(); /* dummy push so we can pop on model
- recalc */
makePointList();
makeSprite();
on value='feature/debugevent'>feature/debugevent main, development code repositoryroot
summaryrefslogtreecommitdiff
path: root/xmerge
AgeCommit message (Expand)AuthorFilesLines
2015-02-23remove unnecessary parenthesis in return statementsNoel Grandin2-8/+8
2014-12-19xmerge: store the original exception in the cause field properlyNoel Grandin1-13/+12
2014-12-12java: fix non-public UNO implementation classesNoel Grandin1-1/+1
2014-12-11java: reduce visibility of fields and methodsNoel Grandin8-16/+16
2014-11-18java: make fields final where possibleNoel Grandin23-49/+49
2014-11-12Fix common typos. No automatic tools. Handmade…Andrea Gelmini2-5/+5
2014-11-12java: convert fields to local variables where possibleNoel Grandin1-2/+1
2014-11-12java: reduce excessive code indentation levelsNoel Grandin3-52/+57
2014-10-18xmerge: use java.nio.ByteBuffer (JDK 1.4+)Robert Antoni Buj i Gelonch1-52/+16
2014-10-16java: when rethrowing, store the original exceptionNoel Grandin5-22/+23
2014-10-16xmerge: use String.formatRobert Antoni Buj i Gelonch2-38/+14
2014-10-16java: ensure that the stream is cleaned up before the method returnsRobert Antoni Buj i Gelonch2-50/+59
2014-10-16java: always use braces for while loopsNoel Grandin2-2/+4
2014-10-16java: reduce the depth of some deeply nested if blocksNoel Grandin1-20/+12
2014-10-13java: import from the same packageRobert Antoni Buj i Gelonch1-2/+0
2014-10-13xmerge: ensure that the stream is cleaned up before the method returnsRobert Antoni Buj i Gelonch1-0/+7
2014-10-10xmerge: The if statement is redundantRobert Antoni Buj i Gelonch6-30/+7
2014-10-07java: simplify conditions involving logical negationNoel Grandin1-2/+2
2014-10-07java: remove some unnecessary intermediary object creationNoel Grandin3-3/+3
2014-10-07xmerge: reuse the value of node.getNodeName() and remove duplicated constantsRobert Antoni Buj i Gelonch3-10/+8
2014-10-02xmerge: reuse the value of value.indexOf and remove duplicated codeRobert Antoni Buj i Gelonch3-29/+27
2014-10-02xmerge: Converting ArrayList to ArrayRobert Antoni Buj i Gelonch1-3/+1
2014-09-29fix more Java1.5 incompatibilityNoel Grandin2-3/+9
2014-09-25java: when rethrowing exceptions, store the original causeNoel Grandin2-12/+6
2014-09-11xmerge: Convert a primitive type into a stringrbuj1-1/+1
2014-09-09xmerge: use String.length()==0 instead of String.equals(empty string)rbuj2-2/+2
2014-09-09xmerge: use a character literalrbuj6-11/+11
2014-09-08xmerge: Integer & Boolean Parsingrbuj4-22/+7
2014-09-04xmerge: javadoc maintenance and minor code formattingrbuj96-4521/+3496
2014-09-03xmerge: replace package.html with package-info.javarbuj20-583/+502
2014-08-30xmerge: fix javadoc errors for JDK 8rbuj9-70/+76
2014-08-20java: don't catch and then just rethrow an exceptionNoel Grandin1-6/+0
2014-08-20