Textured Triangles Appear As Solid White

I’m going nuts trying to figure this out, i have code to load a bitmap and all, and i did all the necessary nonsense to generate a texture but all my triangles still appear as white solid triangles. But here is the weirdest part: (using dev-cpp) i started a new glut project, took some of the loading and drawing code from the project i’m trying to get to work, pasted it in the new glut project, and it worked! I don’t understand it at all.

Some code snippets:

void Reshape( int width, int height )
	game.gameMenu.hScreenWidth = width / 2;
	game.gameMenu.hScreenHeight = height / 2;

	glEnable( GL_BLEND );				// code for transparency
	glViewport(0, 0, width, height);

	glMatrixMode( GL_PROJECTION );		// Change to 1 pixel per gl unit
	glOrtho( -width/2, width/2, height/2, -height/2, -1, 1 );
	glMatrixMode( GL_MODELVIEW );


void GamePlay::draw( )
	glLoadIdentity( );
	glRotatef( angle, 0.0, 0.0, 1.0 );
	glScalef( scaleFactor, scaleFactor, 0.0 );
	glTranslatef( -players[ myIndex ].position.x, -players[ myIndex ].position.y, -200.0f );

	for( int i = 0; i < numTris; i++ )
		glBindTexture( GL_TEXTURE_2D, texs[ tris[ i ].texIndex ] );

		glBegin( GL_TRIANGLES );
			glTexCoord2f( 0.0, 1.0 );
			glVertex2f( tris[ i ].v[ 0 ].x, tris[ i ].v[ 0 ].y );
			glTexCoord2f( 1.0, 1.0 );
			glVertex2f( tris[ i ].v[ 1 ].x, tris[ i ].v[ 1 ].y );
			glTexCoord2f( 0.0, 0.0 );
			glVertex2f( tris[ i ].v[ 2 ].x, tris[ i ].v[ 2 ].y );
		glEnd( );

	for( int i = 0; i < players.size( ); i++ )
		players[ i ].draw( );

void GamePlay::loadMap ( char * filename )
	ifstream mapFile( filename );
	mapFile >> numTris;
	tris = new Triangle [ numTris ];
	mapFile >> numTexs;
	filenames = new char * [ numTexs ];
	for( int i = 0; i < numTexs; i++ )
		filenames[ i ] = new char [ 32 ];
		mapFile.getline( filenames[ i ], 32, '
' );
	for( int i = 0; i < numTris; i++ )
		for( int j = 0; j < 3; j++ )
			mapFile >> tris[ i ].v[ j ].x;
			mapFile >> tris[ i ].v[ j ].y;
		mapFile >> tris[ i ].texIndex;
	mapFile.close( );

void GamePlay::loadTexs ( )
	Bitmap24Bit bmp;
	texs = new GLuint [ numTexs ];
	glGenTextures( numTexs, &texs[ 0 ] );

	for( int i = 0; i < numTexs; i++ )
		bmp.loadBMP( filenames[ i ] );
		glBindTexture( GL_TEXTURE_2D, texs[ i ] );
		glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );

		glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, bmp.width, bmp.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bmp.imageData );

int main(int argc, char **argv)
    glutInit( &argc, argv );


	// Declare the display, idle, reshape, and keyboard functions
	glutDisplayFunc( Draw );
	glutKeyboardFunc( Keyboard );
	glutKeyboardUpFunc( KeyboardUp );
	glutMouseFunc( Mouse );
	glutPassiveMotionFunc( MouseMotion );
	glutReshapeFunc( Reshape );
	glutIdleFunc( Idle );

	glEnable( GL_DEPTH_TEST );
    glDepthFunc( GL_LESS );
	glEnable( GL_TEXTURE_2D );

	// Start the Main Loop

	return true;

All the initialization stuff is nearly identical or at some point was because i was changing every little thing trying to get something to work but nothing did. So basically i’m really confused. It may have something to do with the networking library i’m using (RakNet).

A weird thing about RakNet is that i had everything working… then i started getting this segfault, and went crazy trying to solve it, someone told me to change some lines in one of the headers and i did but nothing changed. I eventually solved the problem, so now i was messing around with things, and i decided to take out the lines that the person told me to put in… all of a sudden, my menu stopped working. I found out the problem was that a variable was assigning itself some weird values… i don’t know how though, because i cout’ed the only line where it was being changed or accessed and it printed out the right value, then i cout’ed where the variable was being used and it was all wrong. So go figure…

Sorry for the essay-like question

Also, i printed out the value of texs[ 0 ] before and after glGenTextures( numTexs, &texs[ 0 ] ); since i’m only using 1 texture right now, it seems to be the same uninitialized value before and after the call. So i’m thinking that’s the problem but i don’t know how to fix it.

Also, it’s not that the filename is wrong or anything. 1st, i would get a segfault because the bitmap class i wrote does not error check because i’m lazy, and 2nd i replaced filenames[ i ] with the actual name of the bitmap and it still didn’t work.

right, so i just made a copy of project directory, and took out all the network code for that copy, and the texturing showed up (it showed up messed up, but at least it showed up) so now i’m stumped, if anyone has any words of wisdom, please share… i think i’m going to take this one to the RakNet forums.