Clipping plane prob?

This is a discussion on Clipping plane prob? within the Game Programming forums, part of the General Programming Boards category; Grr, i have some odd problem and i'm not quite sure of the reason why. I'm not even sure if ...

  1. #1
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72

    Clipping plane prob?

    Grr, i have some odd problem and i'm not quite sure of the reason why. I'm not even sure if its my programming or a prob with my graphics card. It should be easy, this isnt even the thing im trying to program :|.

    All i have is a 50x50 flat plane going along the x,z axis. However, for some reason it doesn't show all of it.

    Look at:
    http://www.dougfur.com/planeprob.jpg

    As you can see the plane gets cut off at what look like an imposed near and far clipping plane, yet im not clipping anything. So if should be whatever the OpenGL defaults are. The plane should stretch of into the distance, but it doesnt. Each square is 1x1 in size so you can see it should go beyond the screen. When i move around the same horizontal lines block any more of the view showing.

    I know it's pretty random but has any got any ideas? is it me or is it some setting i can change on my graphics card?

    Grr again.

  2. #2
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72
    bah... just found another program i can test it on and it works fine... must be my code.... very odd. Maybe a depth buffer problem?

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    can you post the code where you initialize your openGL settings?

  4. #4
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72
    Code:
    int main()
    {
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB);  // Setup the window
    glutInitWindowSize(SCALE, SCALE);  
    glutInitWindowPosition(100, 100);  
    glutCreateWindow("Base Code v1.0"); 
    
    BCConfigureScene();
    
    glutDisplayFunc(display);					 // Display callback
    glutKeyboardFunc(keyboard);					 // Keyboard user input callback 
    
    glutMainLoop();
    
    BCShutDown(0);
    	
    return EXIT_SUCCESS;
    }
    
    void BCConfigureScene()
    {
    int iErrorCheck;
    int static iNameCounter=0;
    float LightAmbient[4]= {0.35f, 0.35f, 0.35f, 1.00f};	// Lighting
    float LightDiffuse[4]= {1.00f, 1.00f, 1.00f, 1.00f};
    float LightPosition[4]={0.00f, 1.00f, 0.00f, 1.00f};
    float LightPosition1[4]={2.00f, 1.00f, 0.00f, 0.00f};
    float MattSpecular[4]= {0.00f, 0.00f, 0.00f, 1.00f};	// Material properties
    float MattShininess[4]={0.0f};
    
    BCLookAt(0.00f, 0.50f, -5.00f, 0.00f, 0.00f, 0.00f, 0, 1, 0);	// Starting cam/view position
    
    glClearColor(0.60f, 0.60f, 0.60f, 1.00f);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);									// Enables depth testing
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);										// Enables back face culling
    
    glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);				// Setup the ambient light
    glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);				// Setup the diffuse light
    glLightfv(GL_LIGHT0, GL_POSITION,LightPosition);			// Position the light
    glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);	
    glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);	
    glLightfv(GL_LIGHT1, GL_POSITION,LightPosition1);
    glMaterialfv(GL_FRONT, GL_SPECULAR, MattSpecular);			// Set material properties
    glMaterialfv(GL_FRONT, GL_SHININESS, MattShininess);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHT1);
    
    return;
    }
    Last edited by gazsux; 07-04-2003 at 06:06 PM.

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Where do you set your projection matrix and the view matrix? Are you sure you don't have your near and far clipping planes very close together? Thats what it looks like to me.

  6. #6
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    hmmm, ive never used GLUT before. are you clearing the depth buffer in your draw routine?

    void draw()
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    ...etc

    }

  7. #7
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72
    Where do you set your projection matrix and the view matrix?
    I don't. where should i set them?

    are you clearing the depth buffer in your draw routine?
    Yep i am.

    Are you sure you don't have your near and far clipping planes very close together?
    Thats what i think, but i haven't set any planes myself. It should be set to whatever the OpenGL presets are.
    Last edited by gazsux; 07-04-2003 at 06:21 PM.

  8. #8
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    OpenGL presets it pretty small. You should set your viewing distance with gluPerspective(). It goes into the projection matrix.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Deal or No Deal listbox prob
    By kryptkat in forum Windows Programming
    Replies: 5
    Last Post: 03-30-2009, 06:53 PM
  2. Insane far plane
    By VirtualAce in forum Game Programming
    Replies: 0
    Last Post: 09-24-2008, 11:36 PM
  3. create plane in 3D and
    By michi7 in forum Tech Board
    Replies: 6
    Last Post: 07-22-2008, 03:31 PM
  4. Textured plane suggestions
    By VirtualAce in forum Game Programming
    Replies: 9
    Last Post: 04-20-2004, 09:28 PM
  5. the plane passing the moon
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-20-2003, 08:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21