ソースを参照

Redo the fragment program examples to match vp's

we just load text files instead of compiling tons of small
binaries
tags/mesa_20090313
Zack Rusin 18年前
コミット
63a9d835ce
70個のファイルの変更155行の追加3765行の削除
  1. 2
    2
      configs/linux-llvm
  2. 2
    34
      progs/fp/Makefile
  3. 5
    0
      progs/fp/abs.txt
  4. 5
    0
      progs/fp/add.txt
  5. 5
    0
      progs/fp/cmp.txt
  6. 8
    0
      progs/fp/cos.txt
  7. 4
    0
      progs/fp/dp3.txt
  8. 4
    0
      progs/fp/dp4.txt
  9. 4
    0
      progs/fp/dph.txt
  10. 3
    0
      progs/fp/dst.txt
  11. 5
    0
      progs/fp/ex2.txt
  12. 5
    0
      progs/fp/flr.txt
  13. 5
    0
      progs/fp/frc.txt
  14. 6
    0
      progs/fp/kil.txt
  15. 5
    0
      progs/fp/lg2.txt
  16. 5
    0
      progs/fp/lit.txt
  17. 4
    0
      progs/fp/lrp.txt
  18. 4
    0
      progs/fp/mad.txt
  19. 3
    0
      progs/fp/max.txt
  20. 3
    0
      progs/fp/min.txt
  21. 3
    0
      progs/fp/mov.txt
  22. 3
    0
      progs/fp/mul.txt
  23. 3
    0
      progs/fp/position.txt
  24. 4
    0
      progs/fp/pow.txt
  25. 5
    0
      progs/fp/rcp.txt
  26. 5
    0
      progs/fp/rsq.txt
  27. 5
    0
      progs/fp/scs.txt
  28. 3
    0
      progs/fp/sge.txt
  29. 8
    0
      progs/fp/sge2.txt
  30. 8
    0
      progs/fp/sin.txt
  31. 3
    0
      progs/fp/slt.txt
  32. 3
    0
      progs/fp/sub.txt
  33. 3
    0
      progs/fp/swz.txt
  34. 4
    0
      progs/fp/swz2.txt
  35. 0
    107
      progs/fp/tri-abs.c
  36. 0
    110
      progs/fp/tri-add.c
  37. 0
    110
      progs/fp/tri-cmp.c
  38. 0
    113
      progs/fp/tri-cos.c
  39. 0
    109
      progs/fp/tri-dp3.c
  40. 0
    109
      progs/fp/tri-dp4.c
  41. 0
    109
      progs/fp/tri-dph.c
  42. 0
    109
      progs/fp/tri-dst.c
  43. 0
    110
      progs/fp/tri-ex2.c
  44. 0
    110
      progs/fp/tri-flr.c
  45. 0
    109
      progs/fp/tri-fp.c
  46. 0
    111
      progs/fp/tri-frc.c
  47. 0
    111
      progs/fp/tri-kil.c
  48. 0
    110
      progs/fp/tri-lg2.c
  49. 0
    111
      progs/fp/tri-lit.c
  50. 0
    109
      progs/fp/tri-lrp.c
  51. 0
    109
      progs/fp/tri-mad.c
  52. 0
    109
      progs/fp/tri-max.c
  53. 0
    109
      progs/fp/tri-min.c
  54. 0
    102
      progs/fp/tri-mov.c
  55. 0
    109
      progs/fp/tri-mul.c
  56. 0
    109
      progs/fp/tri-position.c
  57. 0
    109
      progs/fp/tri-pow.c
  58. 0
    110
      progs/fp/tri-rcp.c
  59. 0
    110
      progs/fp/tri-rsq.c
  60. 0
    111
      progs/fp/tri-scs.c
  61. 0
    109
      progs/fp/tri-sge.c
  62. 0
    114
      progs/fp/tri-sge2.c
  63. 0
    114
      progs/fp/tri-sin.c
  64. 0
    109
      progs/fp/tri-slt.c
  65. 0
    109
      progs/fp/tri-sub.c
  66. 0
    109
      progs/fp/tri-swz.c
  67. 0
    109
      progs/fp/tri-swz2.c
  68. 0
    108
      progs/fp/tri-xpd.c
  69. 3
    0
      progs/fp/xpd.txt
  70. 5
    4
      src/mesa/pipe/llvm/gallivm.cpp

+ 2
- 2
configs/linux-llvm ファイルの表示

@@ -1,8 +1,8 @@
# Configuration for debugging on Linux
# Configuration for Linux and LLVM with debugging info

include $(TOP)/configs/linux

CONFIG_NAME = linux-debug
CONFIG_NAME = linux-llvm

OPT_FLAGS = -g -ansi -pedantic
DEFINES += -DDEBUG -DDEBUG_MATH

+ 2
- 34
progs/fp/Makefile ファイルの表示

@@ -11,46 +11,14 @@ include $(TOP)/configs/current
LIBS = $(APP_LIB_DEPS)

SOURCES = \
tri-abs.c \
tri-add.c \
tri-cmp.c \
tri-cos.c \
tri-dp3.c \
tri-dp4.c \
tri-dph.c \
tri-dst.c \
tri-ex2.c \
tri-flr.c \
tri-frc.c \
tri-kil.c \
tri-lg2.c \
tri-lit.c \
tri-lrp.c \
tri-mad.c \
tri-max.c \
tri-min.c \
tri-mov.c \
tri-mul.c \
tri-pow.c \
tri-param.c \
tri-rcp.c \
tri-rsq.c \
tri-scs.c \
tri-sge.c \
tri-sge2.c \
tri-sin.c \
tri-slt.c \
tri-sub.c \
tri-swz.c \
tri-swz2.c \
tri-tex.c \
tri-xpd.c \
tri-position.c \
point-position.c \
tri-depth.c \
tri-depth2.c \
tri-depthwrite.c \
tri-depthwrite2.c \
tri-param.c \
fp-tri.c

NOTDONE=\
tri-txb.c \

+ 5
- 0
progs/fp/abs.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
SUB R0, {0.5}.x, fragment.color;
ABS result.color, R0;
END

+ 5
- 0
progs/fp/add.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
ADD R0, fragment.color, fragment.color;
ADD result.color, R0, R0;
END

+ 5
- 0
progs/fp/cmp.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
SUB R0, {0.5}.x, fragment.color;
CMP result.color, R0, fragment.color, {0.0}.x;
END

+ 8
- 0
progs/fp/cos.txt ファイルの表示

@@ -0,0 +1,8 @@
!!ARBfp1.0
TEMP R0;
MUL R0, fragment.color, {3.14}.x;
COS result.color.x, R0.x;
COS result.color.y, R0.y;
COS result.color.z, R0.z;
END


+ 4
- 0
progs/fp/dp3.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0;
DP3 result.color, fragment.color, fragment.color;
END

+ 4
- 0
progs/fp/dp4.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0;
DP4 result.color, fragment.color.xxxx, fragment.color;
END

+ 4
- 0
progs/fp/dph.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0;
DPH result.color, fragment.color, fragment.color.xyzx;
END

+ 3
- 0
progs/fp/dst.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
DST result.color, fragment.color, fragment.color;
END

+ 5
- 0
progs/fp/ex2.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
EX2 R0, fragment.color.x;
SUB result.color, R0, {1.0}.x;
END

+ 5
- 0
progs/fp/flr.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
ADD R0, fragment.color, {0.5}.x;
FLR result.color, R0;
END

+ 5
- 0
progs/fp/frc.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
MUL R0, fragment.color, {3.0}.x;
FRC result.color, R0;
END

+ 6
- 0
progs/fp/kil.txt ファイルの表示

@@ -0,0 +1,6 @@
!!ARBfp1.0
TEMP R0;
SUB R0, fragment.color, {0.5,0,0,0};
KIL R0;
MOV result.color, R0;
END

+ 5
- 0
progs/fp/lg2.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
MUL R0, fragment.color, {4.0}.x;
LG2 result.color, R0.x;
END

+ 5
- 0
progs/fp/lit.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
SUB R0, {0.5}.x, fragment.color;
LIT result.color, R0;
END

+ 4
- 0
progs/fp/lrp.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0, R1;
LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1};
END

+ 4
- 0
progs/fp/mad.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0, R1;
MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color;
END

+ 3
- 0
progs/fp/max.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
MAX result.color, {0.5}.x, fragment.color;
END

+ 3
- 0
progs/fp/min.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
MIN result.color, {0.5}.x, fragment.color;
END

+ 3
- 0
progs/fp/mov.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
MOV result.color, fragment.color;
END

+ 3
- 0
progs/fp/mul.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
MUL result.color, fragment.color, fragment.color;
END

+ 3
- 0
progs/fp/position.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
MUL result.color, fragment.position, {.005}.x;
END

+ 4
- 0
progs/fp/pow.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0;
POW result.color, fragment.color.x, fragment.color.y;
END

+ 5
- 0
progs/fp/rcp.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
ADD R0, fragment.color.x, fragment.color.x;
RCP result.color, R0.x;
END

+ 5
- 0
progs/fp/rsq.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
MUL R0, fragment.color, {3.0}.x;
RSQ result.color, R0.x;
END

+ 5
- 0
progs/fp/scs.txt ファイルの表示

@@ -0,0 +1,5 @@
!!ARBfp1.0
TEMP R0;
MUL R0, fragment.color, {3.14}.x;
SCS result.color, R0.x;
END

+ 3
- 0
progs/fp/sge.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
SGE result.color, {0.5}.x, fragment.color;
END

+ 8
- 0
progs/fp/sge2.txt ファイルの表示

@@ -0,0 +1,8 @@
!!ARBfp1.0
TEMP R0;
TEMP R1;
SGE R0, fragment.color, fragment.color.yzxw;
SGE R1, fragment.color, fragment.color.zxyw;
MUL R0, R0, R1;
MUL result.color, R0, fragment.color;
END

+ 8
- 0
progs/fp/sin.txt ファイルの表示

@@ -0,0 +1,8 @@
!!ARBfp1.0
TEMP R0;
MUL R0, fragment.color, {3.14}.x;
MOV result.color, {0.0}.x;
SIN result.color.x, R0.x;
SIN result.color.y, R0.y;
SIN result.color.z, R0.z;
END

+ 3
- 0
progs/fp/slt.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
SLT result.color, {0.5}.x, fragment.color;
END

+ 3
- 0
progs/fp/sub.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
SUB result.color, fragment.color.yzxw, fragment.color;
END

+ 3
- 0
progs/fp/swz.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
SWZ result.color, fragment.color, 1,x,y,z;
END

+ 4
- 0
progs/fp/swz2.txt ファイルの表示

@@ -0,0 +1,4 @@
!!ARBfp1.0
TEMP R0, R1;
SWZ result.color, fragment.color, 1, 0, 0, 1;
END

+ 0
- 107
progs/fp/tri-abs.c ファイルの表示

@@ -1,107 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, {0.5}.x, fragment.color; \n"
"ABS result.color, R0; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();

}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-add.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"ADD R0, fragment.color, fragment.color; \n"
"ADD result.color, R0, R0; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-cmp.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, {0.5}.x, fragment.color; \n"
"CMP result.color, R0, fragment.color, {0.0}.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 113
progs/fp/tri-cos.c ファイルの表示

@@ -1,113 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.14}.x; \n"
"COS result.color.x, R0.x; \n"
"COS result.color.y, R0.y; \n"
"COS result.color.z, R0.z; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-dp3.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"DP3 result.color, fragment.color, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-dp4.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"DP4 result.color, fragment.color.xxxx, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-dph.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"DPH result.color, fragment.color, fragment.color.xyzx; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-dst.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"DST result.color, fragment.color, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}



int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-ex2.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"EX2 R0, fragment.color.x; \n"
"SUB result.color, R0, {1.0}.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-flr.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"ADD R0, fragment.color, {0.5}.x; \n"
"FLR result.color, R0; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-fp.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SLT result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 111
progs/fp/tri-frc.c ファイルの表示

@@ -1,111 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.0}.x; \n"
"FRC result.color, R0; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 111
progs/fp/tri-kil.c ファイルの表示

@@ -1,111 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, fragment.color, {0.5,0,0,0}; \n"
"KIL R0;"
"MOV result.color, R0;"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-lg2.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"MUL R0, fragment.color, {4.0}.x; \n"
"LG2 result.color, R0.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 111
progs/fp/tri-lit.c ファイルの表示

@@ -1,111 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"SUB R0, {0.5}.x, fragment.color; \n"
"LIT result.color, R0; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-lrp.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0, R1;\n"
"LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-mad.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0, R1;\n"
"MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-max.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MAX result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-min.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MIN result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 102
progs/fp/tri-mov.c ファイルの表示

@@ -1,102 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"

static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MOV result.color, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();
}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);

glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB | GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-mul.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.color, fragment.color, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-position.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"MUL result.color, fragment.position, {.005}.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-pow.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"POW result.color, fragment.color.x, fragment.color.y; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-rcp.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"ADD R0, fragment.color.x, fragment.color.x; \n"
"RCP result.color, R0.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 110
progs/fp/tri-rsq.c ファイルの表示

@@ -1,110 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"MUL R0, fragment.color, {3.0}.x; \n"
"RSQ result.color, R0.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 111
progs/fp/tri-scs.c ファイルの表示

@@ -1,111 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.14}.x; \n"
"SCS result.color, R0.x; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-sge.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SGE result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 114
progs/fp/tri-sge2.c ファイルの表示

@@ -1,114 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"TEMP R1;\n"
"SGE R0, fragment.color, fragment.color.yzxw; \n"
"SGE R1, fragment.color, fragment.color.zxyw; \n"
"MUL R0, R0, R1; \n"
"MUL result.color, R0, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 114
progs/fp/tri-sin.c ファイルの表示

@@ -1,114 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0; \n"
"MUL R0, fragment.color, {3.14}.x; \n"
"MOV result.color, {0.0}.x; \n"
"SIN result.color.x, R0.x; \n"
"SIN result.color.y, R0.y; \n"
"SIN result.color.z, R0.z; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-slt.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SLT result.color, {0.5}.x, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-sub.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SUB result.color, fragment.color.yzxw, fragment.color; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-swz.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"SWZ result.color, fragment.color, 1,x,y,z; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 109
progs/fp/tri-swz2.c ファイルの表示

@@ -1,109 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"TEMP R0, R1;\n"
"SWZ result.color, fragment.color, 1, 0, 0, 1; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);



glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 0
- 108
progs/fp/tri-xpd.c ファイルの表示

@@ -1,108 +0,0 @@

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define GL_GLEXT_PROTOTYPES
#include <GL/glut.h>
#include "GL/gl.h"



static void Init( void )
{
static const char *modulate2D =
"!!ARBfp1.0\n"
"XPD result.color, fragment.color, {2,2,2,0}; \n"
"END"
;
GLuint modulateProg;

if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Error: GL_ARB_fragment_program not supported!\n");
exit(1);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));

/* Setup the fragment program */
glGenProgramsARB(1, &modulateProg);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(modulate2D), (const GLubyte *)modulate2D);

printf("glGetError = 0x%x\n", (int) glGetError());
printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));

glEnable(GL_FRAGMENT_PROGRAM_ARB);

glClearColor(.3, .3, .3, 0);
}

static void Reshape(int width, int height)
{

glViewport(0, 0, (GLint)width, (GLint)height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
glMatrixMode(GL_MODELVIEW);
}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
case 27:
exit(1);
default:
return;
}

glutPostRedisplay();
}

static void Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(0,0,1);
glVertex3f( 0.9, -0.9, -30.0);
glColor3f(1,0,0);
glVertex3f( 0.9, 0.9, -30.0);
glColor3f(0,1,0);
glVertex3f(-0.9, 0.0, -30.0);
glEnd();

glFlush();


}


int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);


glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);

type = GLUT_RGB;
type |= GLUT_SINGLE;
glutInitDisplayMode(type);

if (glutCreateWindow("First Tri") == GL_FALSE) {
exit(1);
}

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}

+ 3
- 0
progs/fp/xpd.txt ファイルの表示

@@ -0,0 +1,3 @@
!!ARBfp1.0
XPD result.color, fragment.color, {2,2,2,0};
END

+ 5
- 4
src/mesa/pipe/llvm/gallivm.cpp ファイルの表示

@@ -157,6 +157,7 @@ add_interpolator(struct gallivm_prog *prog,
prog->interpolators[prog->num_interp] = *interp;
++prog->num_interp;
}

static void
translate_declaration(struct gallivm_prog *prog,
llvm::Module *module,
@@ -470,8 +471,6 @@ translate_instruction(llvm::Module *module,
break;
case TGSI_OPCODE_TXD:
break;
case TGSI_OPCODE_TXP:
break;
case TGSI_OPCODE_UP2H:
break;
case TGSI_OPCODE_UP2US:
@@ -1015,11 +1014,12 @@ struct gallivm_cpu_engine * gallivm_cpu_engine_create(struct gallivm_prog *prog)
llvm::Module *mod = static_cast<llvm::Module*>(prog->module);
llvm::ExistingModuleProvider *mp = new llvm::ExistingModuleProvider(mod);
llvm::ExecutionEngine *ee = llvm::ExecutionEngine::create(mp, false);
ee->DisableLazyCompilation();
cpu->engine = ee;

llvm::Function *func = func_for_shader(prog);

prog->function = ee->getPointerToFunctionOrStub(func);
prog->function = ee->getPointerToFunction(func);
CPU = cpu;
return cpu;
}
@@ -1037,10 +1037,11 @@ void gallivm_cpu_jit_compile(struct gallivm_cpu_engine *cpu, struct gallivm_prog
llvm::ExistingModuleProvider *mp = new llvm::ExistingModuleProvider(mod);
llvm::ExecutionEngine *ee = cpu->engine;
assert(ee);
ee->DisableLazyCompilation();
ee->addModuleProvider(mp);

llvm::Function *func = func_for_shader(prog);
prog->function = ee->getPointerToFunctionOrStub(func);
prog->function = ee->getPointerToFunction(func);
}

void gallivm_cpu_engine_delete(struct gallivm_cpu_engine *cpu)

読み込み中…
キャンセル
保存