Jump to content
  • Advertisement
Sign in to follow this  
TheSeb

big problem of frames per second

This topic is 4853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.textureNames) > 0)
		{ 
			SDL_Surface *texture=IMG_Load(myLoader->myObjects.textureNames/*"wood_b.jpg"*//*"bois.bmp""eyeball.tif"*//*"eyeball.JPG"*//*myLoader->myObjects.textureNames*//*"wood_b.TGA""herbe.bmp"*/);
			cout<<"texture "<<texture<<" nomTex "<<myLoader->myObjects.textureNames<<endl ;//gérer le compteur d'objets dans 0xa300
			
			glBindTexture (GL_TEXTURE_2D, texname) ;
	
			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
Advertisement
Quote:

//delete texture
glEnable(GL_TEXTURE_2D) ;


gdEnable(GL_TEXTURE_2D) doesn't delete any textures. [rolleyes]
Post your main loop code.

Share this post


Link to post
Share on other sites
the variable which contains the texture is deleted at the end of the if part, you're talking about that ?

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!