Sign in to follow this  
TheSeb

big problem of frames per second

Recommended Posts

Hi, i display my model (about 10000 triangles) without texturing and i have about 200 fps with the per fragment lighting. But when i execute the texturing code i just have about 7 or 10 fps... these are code parts :
int main(int argc, char *argv[])
{
	myLoader= new loader3ds() ;
		
	glutInit (&argc, argv) ;
	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH) ;
	glutInitWindowSize (640, 640) ;
	glutInitWindowPosition (250,250) ;
	glutCreateWindow (argv [0]) ;
	glewInit();

	glEnable( GL_DEPTH_TEST );
	glClearColor(0, 0, 1, 0);
	
	myLoader->lighting() ;
	myLoader->loadTextures() ;
	
	glutReshapeFunc (reshape) ;
	glutKeyboardFunc (keyboard) ;
	glutDisplayFunc (display) ;
	glutIdleFunc(display);


	loadShader *myShaderLoader = new loadShader("vertexShader.vert", "fragmentShader.frag");

	glutMainLoop () ;
	return 0 ;
}



void loader3ds::loadTextures ()
{
	glGenTextures (myLoader->getCounterObj()+1, texname);	
	int i ;
	for(i=0 ; i <=/*1*/ myLoader->getCounterObj() ; i++)
	{
		if(strlen(myLoader->myObjects[i].textureNames) > 0)
		{ 
			SDL_Surface *texture=IMG_Load(myLoader->myObjects[i].textureNames/*"wood_b.jpg"*//*"bois.bmp""eyeball.tif"*//*"eyeball.JPG"*//*myLoader->myObjects[i].textureNames*//*"wood_b.TGA""herbe.bmp"*/);
			cout<<"texture "<<texture<<" nomTex "<<myLoader->myObjects[i].textureNames<<endl ;//gérer le compteur d'objets dans 0xa300
			
			glBindTexture (GL_TEXTURE_2D, texname[i]) ;
	
			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
			glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
			glTexParameteri (GL_TEXTURE_2D,	GL_TEXTURE_MAG_FILTER,GL_LINEAR);
			glTexParameteri (GL_TEXTURE_2D,	GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	
			glTexImage2D(GL_TEXTURE_2D, 0, 3, texture->w, texture->h,
					0, GL_RGB, GL_UNSIGNED_BYTE, texture->pixels);
	
	          }
	}
        //delete texture
	glEnable(GL_TEXTURE_2D) ;
}


Share this post


Link to post
Share on other sites
Quote:
Original post by vNistelrooy
Post your main loop code.


He meant, post your rendering code. That's probably where the problem resides.

Tom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this