Texture problems

Started by
1 comment, last by ShmeeBegek 20 years, 8 months ago
*Sigh* I''ve been using textures in OpenGL for years now but they are allways unreliable and unpredictable. Usually I can fiddle with them enough that they work, but in the simple case I cannot get them to work proporly. Its a simple thing I''m doing, every frame I put new image info into the texture then apply it to a quad the size of the screen (aka. project it up onto the screen). This allows for easy resizing of the screen etc. Problem is its not working, I''m left with a white polygon every time no matter the input. The texture is created as follows:

		glEnable(GL_TEXTURE_2D);
		glGenTextures(1, &texid);
		glBindTexture(GL_TEXTURE_2D, texid);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

And then the image data is put into it and its applied to the square (on every frame, the preceeding code was only done once at the beginning):

	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, texid);	
	glTexImage2D(GL_TEXTURE_2D, 0, 3, 100, 100, 0, GL_RGB, GL_UNSIGNED_BYTE, screen);
	glColor4f(1.0f,1.0f,1.0f,1.0f);
	glBegin(GL_QUADS);
	glTexCoord2f(0.0f,0.0f);glVertex2f(0.0f,0.0f);
	glTexCoord2f(1.0f,0.0f);glVertex2f(1.0f,0.0f);
	glTexCoord2f(1.0f,1.0f);glVertex2f(1.0f,1.0f);
	glTexCoord2f(0.0f,1.0f);glVertex2f(0.0f,1.0f);
	glEnd();
Thanks, ~SPH
AIM ME: aGaBoOgAmOnGeR
Advertisement
try increasing your textre size to something with power of 2 (ie 128x128)
http://mitglied.lycos.de/lousyphreak/

Oh yeah... fuck... heheh'' sorry about that

~SPH

AIM ME: aGaBoOgAmOnGeR

This topic is closed to new replies.

Advertisement