projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mesa: add additional texture size/limit assertions
[mesa.git]
/
progs
/
trivial
/
quad-offset-units.c
diff --git
a/progs/trivial/quad-offset-units.c
b/progs/trivial/quad-offset-units.c
index 5c41be308ee17d417fd3953096f8e475880f71a5..d5db21469e61dacee1f759df01cc4dae762c9db6 100644
(file)
--- a/
progs/trivial/quad-offset-units.c
+++ b/
progs/trivial/quad-offset-units.c
@@
-27,11
+27,6
@@
#include <stdlib.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <GL/glut.h>
-
-#define CI_OFFSET_1 16
-#define CI_OFFSET_2 32
-
-
GLenum doubleBuffer;
static void Init(void)
GLenum doubleBuffer;
static void Init(void)
@@
-45,7
+40,6
@@
static void Init(void)
static void Reshape(int width, int height)
{
static void Reshape(int width, int height)
{
-
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
@@
-56,7
+50,6
@@
static void Reshape(int width, int height)
static void Key(unsigned char key, int x, int y)
{
static void Key(unsigned char key, int x, int y)
{
-
switch (key) {
case 27:
exit(1);
switch (key) {
case 27:
exit(1);
@@
-75,7
+68,6
@@
static void quad( float half )
glVertex3f(-half/9.0, half/9.0, -25.0 - half);
glVertex3f(-half/9.0, -half/9.0, -25.0 - half);
glEnd();
glVertex3f(-half/9.0, half/9.0, -25.0 - half);
glVertex3f(-half/9.0, -half/9.0, -25.0 - half);
glEnd();
-
}
static void Draw(void)
}
static void Draw(void)
@@
-83,27
+75,26
@@
static void Draw(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
-
-
+ /* red: offset back */
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0, 4);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0, 4);
-
glColor3f(1,0,0);
quad(9);
glColor3f(1,0,0);
quad(9);
+ /* black: no offset */
glDisable(GL_POLYGON_OFFSET_FILL);
glColor3f(0,0,0);
quad(6);
glDisable(GL_POLYGON_OFFSET_FILL);
glColor3f(0,0,0);
quad(6);
+ /* green: offset 0 (this should obscure the black quad) */
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0, 0);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0, 0);
-
glDepthFunc( GL_EQUAL );
glColor3f(0,1,0);
quad(6);
glDepthFunc( GL_EQUAL );
glColor3f(0,1,0);
quad(6);
- glDepthFunc( GL_LESS );
-
+ /* blue: offset forward */
+ glDepthFunc( GL_LESS );
glPolygonOffset(0, -4);
glColor3f(0,0,1);
quad(3);
glPolygonOffset(0, -4);
glColor3f(0,0,1);
quad(3);
@@
-148,7
+139,7
@@
int main(int argc, char **argv)
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
- type = GLUT_RGB | GLUT_DEPTH;
+ type = GLUT_RGB | GLUT_
ALPHA | GLUT_
DEPTH;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
@@
-162,5
+153,5
@@
int main(int argc, char **argv)
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
-
return 0;
+ return 0;
}
}