Jump to content

  • Log In with Google      Sign In   
  • Create Account


Some kind of culling problem in opengl.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Vlion   Members   -  Reputation: 151

Like
Likes
Like

Posted 30 August 2001 - 07:21 AM

OK. Here''s the problem. I have a square group of a variable number of polygons, all with z = 0. Next, I have a single polygon at a variable z. At a certain camera distance from z = 0, the single polygon appears to slip thru and behind the wall of polygons behind it. When I change the glBegin(GL_mode) parameter, the same thing happens. Could someone help me ? Here is the relevant code:
//From the init() function
{
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(SCRNX,SCRNY);
	glutInitWindowPosition(0,0);
	glutInit(&argc,argv);
	
	glutCreateWindow("Bugle");
	
	glClearColor(0,0,0,0);
	glViewport(0,0,SCRNX,SCRNY);
	glMatrixMode(GL_PROJECTION);
	
	glLoadIdentity();
	gluPerspective(60.0f, SCRNX/SCRNY, 0.001f, 1000.0f);
	glShadeModel(GL_SMOOTH);
	
	glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
	
	glEnable(GL_DEPTH_TEST);
	
	glEnable(GL_CULL_FACE);
	glFrontFace(GL_CCW);
	glCullFace(GL_FRONT);
}
//from the render() function
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef(tx,ty,tz);
	gluLookAt(eyex,eyey,eyez,px,py,pz,0,1,0);

}
 
I came, I saw, I got programmers block. ~V''''lion

Sponsor:

#2 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 30 August 2001 - 10:46 AM

didnt really understand but it sounds like depth precision problem

gluPerspective(60.0f, SCRNX/SCRNY, 0.001f, 1000.0f);
very bad precision here

change the 0.001 to 1

#3 Vlion   Members   -  Reputation: 151

Like
Likes
Like

Posted 30 August 2001 - 05:24 PM

ahh....precisly.
On to texturing !
:-)
Thanks verra much.
~V''lion

I came, I saw, I got programmers block.
~V''''lion

#4 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 30 August 2001 - 06:00 PM

http://web2.airmail.net/sjbaker1/omniv.html

check out learn to love your zbuffer (or something like that)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS