Skip to main content
GameDev.net gamedev.net
🔒 Locked

Failures in my scene.

Started by Tsumuji Jan 23, 2007 at 9:17 AM 5 replies 900+ views
Original Post
Tsumuji
Tsumuji
When I render my scenes, I allways observe that failures happen when rendering quads or triangles. This failures are like that, one quad that touch the other, cannot fill correctly the space between them. So if I fill my space with glClearColor( 0.0, 1.0, 0.0, 1.0 ); little squares appear between the primitives. This happen depending on the camera angle. On some angles everything is ok, but others, I can see 3, 4, 5 of this points. How do I solve this? This is a picture of this problem. Is not very descriptive, but give an ideia: normal with failure Note that this numbers rotate in x axys. While they rotate, the spaces appear.
jouley
jouley
Could we see the code where you're rendering the polygons, and anything else that may be relevant?

-jouley
Tsumuji
Tsumuji
There no gaps.

initialization code:
...	glEnable( GL_DEPTH_TEST );	glDepthFunc( GL_LEQUAL );	glEnable( GL_CULL_FACE );	glCullFace(GL_BACK);	glPolygonMode( GL_FRONT, GL_FILL ); //default	glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );	glClearColor( 0.0, 1.0, 0.0, 1.0 );	glClearDepth( 1.0 );	glViewport( 0, 0, this->window.w, this->window.h );	glEnable( GL_BLEND );	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);	glEnable(GL_TEXTURE_2D);...


The code:
...int slotgame::render(){	float centerposw = this->window.w/2.0;	float centerposh = this->window.h/2.0;	glDisable( GL_CULL_FACE );		setOrthographicMode( this->window.w, this->window.h );//	glTranslatef( 250.0, 0.0, 0.0 );//	glRotatef( 85, 0.0, 1.0, 0.0 );//	glRotatef( 15, 0.0, 0.0, 1.0 );	/*	glBegin( GL_TRIANGLES );	glVertex3f( 0.0, 0.0, 0.0 );	glVertex3f( 1.0, 0.0, 0.0 );	glVertex3f( 0.0, 1.0, 0.0 );	glEnd();*/		//Fundo	glPushMatrix();	glTranslatef( centerposw, centerposh, 0.0 );	_fundo.render();	glPopMatrix();	//Fundo	//	unsetOrthographicMode();//	return 0;	//linhas	for ( unsigned int j=0; j<8; j++ ){		//colunas		for ( unsigned int i=0; i<5; i++ ){			glPushMatrix();			glTranslatef( centerposw - _sprts.at(i+5*j).width()*2 + _sprts.at(i+5*j).width()*i,				centerposh /*+ _sprts.at(i+5*j).width() - _sprts.at(i+5*j).width()*j*/,				0.0 );						if ( not _paraRoda.at(i) )				_sprts.at(i+5*j).rotate( (45.0*j)-45.0 + rdtsc()/10000000, 1.0, 0.0, 0.0 );			else{				_sprts.at(i+5*j).rotate();						_sprts.at(i+5*j).render( 120.0 );			glPopMatrix();					}	}		unsetOrthographicMode();	return 0;}...


...int slotsprite::render(){	return this->render( 0.0 );}int slotsprite::render( float zMod ){		//_lastxRotDegree -= 		glBindTexture( GL_TEXTURE_2D, _myTexture.id() );		glColor3f(1.0,1.0,1.0);		glBegin( GL_QUADS );/*	glTexCoord2f( 0.0, 0.0 ); glVertex3f( 0.0, 0.0, 0.0 );	glTexCoord2f( 1.0, 0.0 ); glVertex3f( (1.0 * _mySize), 0.0, 0.0 );	glTexCoord2f( 1.0, 1.0 ); glVertex3f( (1.0 * _mySize), (1.0 * _mySize), 0.0 );	glTexCoord2f( 0.0, 1.0 ); glVertex3f( 0.0, (1.0 * _mySize), 0.0 );*/		glTexCoord2f( 0.0, 0.0 ); glVertex3f( (-0.5 * _mySizeW), (-0.5 * _mySizeH), 0.0 + zMod );	glTexCoord2f( 1.0, 0.0 ); glVertex3f( (0.5 * _mySizeW), (-0.5 * _mySizeH),  0.0 + zMod );	glTexCoord2f( 1.0, 1.0 ); glVertex3f( (0.5 * _mySizeW), (0.5 * _mySizeH),   0.0 + zMod );	glTexCoord2f( 0.0, 1.0 ); glVertex3f( (-0.5 * _mySizeW), (0.5 * _mySizeH),  0.0 + zMod );	glEnd();		return 0;}...


This is the main code. As you can see, the code is clean and normal. Might be some type of OpenGL initialization?

EDIT:
Look at this scene. Is more representative for the problem:

See the small two green points on the ground? They appear sporadicaly on the ground as I move the camera.

[Edited by - Tsumuji on January 23, 2007 5:17:11 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.