Results 1 to 2 of 2

Thread: adding a 3D cone to a line

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2011
    Posts
    3

    adding a 3D cone to a line

    I have this standard line made in my program
    glBegin(GL_LINES);
    glColor3f(0.0f, 1.0f, 1.0f);
    glVertex3f(Cx,Cy,Cz);
    glVertex3f(Nx+Cx,Ny+Cy,Nz+Cz);
    glEnd();

    The thing is I want to make a cone on the end of the line
    from (Nx+Cx,Ny+Cy,Nz+Cz) to (Nx+Cx,Ny+Cy,Nz+Cz)+5 or whatever value makes it looks better so that the lines look like arrows

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    1

    Re: adding a 3D cone to a line

    try this:

    gl.glColor3f( 0f,0f,0f);
    glu.gluSphere(glu.gluNewQuadric(), 0.002, 10,10);

    //x
    gl.glRotatef(90,0f,1f,0f);
    gl.glColor3d(.6f,.0f,.0f); // x = blue

    glu.gluCylinder(glu.gluNewQuadric(), .001, .001, .1, 10, 10); gl.glTranslatef(0,0,.1f); glu.gluCylinder(glu.gluNewQuadric(), .002f, .0f, 0.01f, 10,10);
    gl.glTranslatef(0,0,-.1f);
    gl.glRotatef(-90,0f,1f,0f);

    //y
    gl.glRotatef(-90,1f,0f,0f);
    gl.glColor3d(0.0f,.6f,.0f); // y = red
    glu.gluCylinder(glu.gluNewQuadric(), .001, .001, .1, 10,10); gl.glTranslatef(0,0,.1f); glu.gluCylinder(glu.gluNewQuadric(), .002f, .0f, 0.01f, 10,10);
    gl.glTranslatef(0,0,-.1f);
    gl.glRotatef(90,1f,0f,0f);

    //z
    gl.glColor3d(.0f,.0f,.6f); // z = green
    glu.gluCylinder(glu.gluNewQuadric(), .001, .001, .1, 10,10); gl.glTranslatef(0,0,.1f); glu.gluCylinder(glu.gluNewQuadric(), .002f, .0f, 0.01f, 10,10);

Similar Threads

  1. OGL noob question - Writing a line upon a line, avoiding conflict
    By Prospero in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-19-2015, 07:37 PM
  2. Replies: 7
    Last Post: 01-05-2013, 10:50 AM
  3. fast cone-cone-intersection
    By satan in forum OpenGL: General
    Replies: 2
    Last Post: 02-28-2006, 10:46 AM
  4. A cone pointer for a line
    By in forum OpenGL: Basic Coding
    Replies: 15
    Last Post: 03-17-2003, 04:41 PM
  5. Intersection of a line and a cone?
    By Robbo in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 03-03-2002, 01:39 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