Results 1 to 5 of 5

Thread: Rendering problem

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Rendering problem

    The following is the code for drawing a Electric pole in a scene.
    While I execute the pole always stands little above the ground position. It is not fixed on the ground. What may be problem

    void draw_pole()
    {
    glBegin(GL_LINES);
    glVertex2f(0.0f,0.0f);
    glVertex2f(0.0f,2.0f);
    glEnd();
    glBegin(GL_LINES);
    glVertex2f(-2.0f,4.0f);
    glVertex2f(2.0f,4.0f);
    glEnd();
    }

  2. #2
    Guest

    Re: Rendering problem

    Well, I'm going to assume you're not drawing the ground at Y=0...which could be a problem...but there's no way to tell as you've provided about as little information as anyone could humanly provide..=P (Can we see some more code?)

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jul 2003
    Location
    Bangalore, Karnataka, India
    Posts
    123

    Re: Rendering problem

    I have a more detailed code.First I am adding a Ground in the scene. On the top of it I am drawing the ELectric pole.

    void renderScene(void)
    {
    glColor3f(0.6f, 0.6f, 0.9f);
    glBindTexture(GL_TEXTURE_2D,texName[1]);
    glBegin(GL_QUADS);
    /* All Tex coordinate were added */
    glTexCoord2f(0.0,0.0);
    glVertex3f(-100.0f, 0.0f, -100.0f);
    glTexCoord2f(0.0,1.0);
    glVertex3f(-100.0f, 0.0f, 100.0f);
    glTexCoord2f(1.0,1.0);
    glVertex3f( 100.0f, 0.0f, 100.0f);
    glTexCoord2f(1.0,0.0);
    glVertex3f( 100.0f, 0.0f, -100.0f);
    glEnd();

    glTranslatef(0,1.75,0);
    for(l =-5;l<5;l++)
    {
    for(m=-5;m<5;m++)
    {
    glPushMatrix();
    glTranslatef(l*10.0,0.0,m*10.0);
    if(l%2 == 0 && m%2 == 0)
    {
    draw_pole();
    }
    else
    {
    draw_barn();
    }
    glPopMatrix();
    }
    }
    }

    draw_pole()
    {

    already given above
    }

    Regards

  4. #4
    Guest

    Re: Rendering problem

    What is this line intended to do?

    Code :
    glTranslatef(0,1.75,0);

  5. #5
    Guest

    Re: Rendering problem

    That line would be the reason why the flag pole isn't being attached to the ground.

Similar Threads

  1. Rendering problem
    By andrei.alex in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-13-2015, 04:50 AM
  2. Problem rendering
    By Darth_Malloc in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-12-2012, 10:38 PM
  3. Rendering problem
    By tabor25 in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 07-10-2007, 05:08 PM
  4. Problem with rendering
    By Satyajit in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-23-2007, 03:32 AM
  5. problem with rendering
    By dlswimmer in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-04-2004, 10:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean