~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to progs/samples/accum.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
3
 
 *
4
 
 * Permission to use, copy, modify, distribute, and sell this software and
5
 
 * its documentation for any purpose is hereby granted without fee, provided
6
 
 * that (i) the above copyright notices and this permission notice appear in
7
 
 * all copies of the software and related documentation, and (ii) the name of
8
 
 * Silicon Graphics may not be used in any advertising or
9
 
 * publicity relating to the software without the specific, prior written
10
 
 * permission of Silicon Graphics.
11
 
 *
12
 
 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
13
 
 * ANY KIND,
14
 
 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15
 
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16
 
 *
17
 
 * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
18
 
 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19
 
 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20
 
 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21
 
 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22
 
 * OF THIS SOFTWARE.
23
 
 */
24
 
#include <stdio.h>
25
 
#include <string.h>
26
 
#include <stdlib.h>
27
 
#include <GL/glut.h>
28
 
 
29
 
 
30
 
GLenum doubleBuffer;
31
 
GLint thing1, thing2;
32
 
 
33
 
 
34
 
static void Init(void)
35
 
{
36
 
 
37
 
    glClearColor(0.0, 0.0, 0.0, 0.0);
38
 
    glClearAccum(0.0, 0.0, 0.0, 0.0);
39
 
 
40
 
    thing1 = glGenLists(1);
41
 
    glNewList(thing1, GL_COMPILE);
42
 
        glColor3f(1.0, 0.0, 0.0);
43
 
        glRectf(-1.0, -1.0, 1.0, 0.0);
44
 
    glEndList();
45
 
 
46
 
    thing2 = glGenLists(1);
47
 
    glNewList(thing2, GL_COMPILE);
48
 
        glColor3f(0.0, 1.0, 0.0);
49
 
        glRectf(0.0, -1.0, 1.0, 1.0);
50
 
    glEndList();
51
 
}
52
 
 
53
 
static void Reshape(int width, int height)
54
 
{
55
 
 
56
 
    glViewport(0, 0, (GLint)width, (GLint)height);
57
 
 
58
 
    glMatrixMode(GL_PROJECTION);
59
 
    glLoadIdentity();
60
 
    glMatrixMode(GL_MODELVIEW);
61
 
    glLoadIdentity();
62
 
}
63
 
 
64
 
static void Key(unsigned char key, int x, int y)
65
 
{
66
 
    (void) x;
67
 
    (void) y;
68
 
    switch (key) {
69
 
      case 27:
70
 
        exit(1);
71
 
      case '1':
72
 
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
73
 
        break;
74
 
      case '2':
75
 
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
76
 
        break;
77
 
      default:
78
 
        return;
79
 
    }
80
 
 
81
 
    glutPostRedisplay();
82
 
}
83
 
 
84
 
static void Draw(void)
85
 
{
86
 
 
87
 
    glPushMatrix();
88
 
 
89
 
    glScalef(0.8, 0.8, 1.0);
90
 
 
91
 
    glClear(GL_COLOR_BUFFER_BIT);
92
 
    glCallList(thing1);
93
 
    glAccum(GL_LOAD, 0.5);
94
 
 
95
 
    glClear(GL_COLOR_BUFFER_BIT);
96
 
    glCallList(thing2);
97
 
    glAccum(GL_ACCUM, 0.5);
98
 
 
99
 
    glAccum(GL_RETURN, 1.0);
100
 
 
101
 
    glPopMatrix();
102
 
 
103
 
    glFlush();
104
 
 
105
 
    if (doubleBuffer) {
106
 
        glutSwapBuffers();
107
 
    }
108
 
}
109
 
 
110
 
static GLenum Args(int argc, char **argv)
111
 
{
112
 
    GLint i;
113
 
 
114
 
    doubleBuffer = GL_FALSE;
115
 
 
116
 
    for (i = 1; i < argc; i++) {
117
 
        if (strcmp(argv[i], "-sb") == 0) {
118
 
            doubleBuffer = GL_FALSE;
119
 
        } else if (strcmp(argv[i], "-db") == 0) {
120
 
            doubleBuffer = GL_TRUE;
121
 
        } else {
122
 
            printf("%s (Bad option).\n", argv[i]);
123
 
            return GL_FALSE;
124
 
        }
125
 
    }
126
 
    return GL_TRUE;
127
 
}
128
 
 
129
 
int main(int argc, char **argv)
130
 
{
131
 
    GLenum type;
132
 
 
133
 
    glutInit(&argc, argv);
134
 
 
135
 
    if (Args(argc, argv) == GL_FALSE) {
136
 
        exit(1);
137
 
    }
138
 
 
139
 
    glutInitWindowPosition(0, 0);
140
 
    glutInitWindowSize( 300, 300);
141
 
 
142
 
    type = GLUT_RGB | GLUT_ACCUM;
143
 
    type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
144
 
    glutInitDisplayMode(type);
145
 
 
146
 
    if (glutCreateWindow("Accum Test") == GL_FALSE) {
147
 
        exit(1);
148
 
    }
149
 
 
150
 
    Init();
151
 
 
152
 
    glutReshapeFunc(Reshape);
153
 
    glutKeyboardFunc(Key);
154
 
    glutDisplayFunc(Draw);
155
 
    glutMainLoop();
156
 
        return 0;
157
 
}