88 glFrustum(-2.0, 2.0, -2.0, 2.0, 6.0, 20.0);
97 static int width = 8, height = 8;
98 static int color[2][3]={
103 static GLubyte texchar[2][8*8] = {
105 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 1, 0, 0, 0,
107 0, 0, 0, 1, 1, 0, 0, 0,
108 0, 0, 0, 0, 1, 0, 0, 0,
109 0, 0, 0, 0, 1, 0, 0, 0,
110 0, 0, 0, 0, 1, 0, 0, 0,
111 0, 0, 0, 1, 1, 1, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0},
114 0, 0, 0, 0, 0, 0, 0, 0,
115 0, 0, 0, 2, 2, 0, 0, 0,
116 0, 0, 2, 0, 0, 2, 0, 0,
117 0, 0, 0, 0, 0, 2, 0, 0,
118 0, 0, 0, 0, 2, 0, 0, 0,
119 0, 0, 0, 2, 0, 0, 0, 0,
120 0, 0, 2, 2, 2, 2, 0, 0,
121 0, 0, 0, 0, 0, 0, 0, 0}};
128 for (i = 0; i < height; i++) {
129 for (j = 0; j < width; j++) {
130 int p = i * width + j;
131 if (texchar[image][(height - i - 1) * width + j]) {
132 tex[p][0] = color[image][0];
133 tex[p][1] = color[image][1];
134 tex[p][2] = color[image][2];
195 return ui_loop(argc, argv,
"texobj");
void glColor3f(float x, float y, float z)
void glVertex2f(float x, float y)
void glTexCoord2f(float s, float t)
void glFrustum(double left, double right, double bottom, double top, double near, double far)
@ GL_PERSPECTIVE_CORRECTION_HINT
void glTexImage2D(int target, int level, int components, int width, int height, int border, int format, int type, void *pixels)
void glViewport(int x, int y, int width, int height)
void glMatrixMode(int mode)
void glHint(int target, int mode)
void glRotatef(float angle, float x, float y, float z)
void glBindTexture(int target, int texture)
void glTexEnvi(int target, int pname, int param)
void glTranslatef(float x, float y, float z)
void glLoadIdentity(void)
void glTexParameteri(int target, int pname, int param)
void glGenTextures(int n, unsigned int *textures)
int ui_loop(int argc, char **argv, const char *name)
GLenum key(int k, GLenum mask)
void bind_texture(int texobj, int image)
int main(int argc, char **argv)
void reshape(int width, int height)