On Wed, 2006-20-12 at 23:25 -0500, James C Georgas wrote:
> > I'm pretty sure that when the target isn't GL_TEXTURE_RECTANGLE or
> > GL_ARB_texture_non_power_of_two isn't supported that Mesa already sets
> > this error code.
>
> Yeah, that's the theory, but it's not happening with today's git image.
>
> I'm attaching a test program that cheerfully accepts dimensions of 5x7
> and interprets the array data accordingly, at least with the software
> renderer. Am I using the right functions?
and here's the attachment :)
#include <GL/glut.h>
#define TEX_SIZE 8
#define TILE_SIZE 100
// texture colors:
#define X {255,0,0,255}
#define O {0,0,0,0}
GLuint texture = 0;
static GLubyte image[TEX_SIZE][TEX_SIZE][4] =
{
{X,X,X,X,X,X,X,X},
{O,O,O,O,O,O,O,O},
{X,X,X,X,X,X,X,X},
{O,O,O,O,O,O,O,O},
{X,X,X,X,X,X,X,X},
{O,O,O,O,O,O,O,O},
{X,X,X,X,X,X,X,X},
{O,O,O,O,O,O,O,O},
};
static void display(void)
{
glColor3f(1, 1, 1);
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(0, 0);
glTexCoord2f(1, 0); glVertex2f(TILE_SIZE, 0);
glTexCoord2f(1, 1); glVertex2f(TILE_SIZE, TILE_SIZE);
glTexCoord2f(0, 1); glVertex2f(0, TILE_SIZE);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, 0, height, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(TILE_SIZE, TILE_SIZE);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutCreateWindow(argv[0]);
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 5, 7, 0
, GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable(GL_TEXTURE_2D);
glutMainLoop();
return 0;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev