Results 1 to 8 of 8

Thread: how can I make solid and wire frame cube ?

  1. #1
    Member Newbie
    Join Date
    Feb 2011
    Posts
    37

    how can I make solid and wire frame cube ?

    how can I make solid AND wire frame cube ?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: how can I make solid and wire frame cube ?

    if u can use glut call glutSolidCube(1) for solid and glutWireCube(1) for wire unitcube
    Regards,
    Mobeen

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2010
    Location
    Brazil, Rio de Janeiro
    Posts
    147

    Re: how can I make solid and wire frame cube ?

    If you wanna draw your entire scene in wireframe you can use

    Code :
    glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );

    before your draw calls.

  4. #4
    Member Newbie
    Join Date
    Feb 2011
    Posts
    37

    Re: how can I make solid and wire frame cube ?

    Hm... I am fighting with cube - left side must be always in the same place and right side can go up or down like in train or like in arm - my previous subject - so now I have found that code - two cubes, one has got angle 45 degrees and second - 45 degrees:
    Code :
    glPushMatrix();
       glTranslatef(0, 0, -70.0f);
       glTranslatef (-1.0, 0.0, 0.0);
       glRotatef (45, 0.0, 0.0, 1.0);
       glTranslatef (1.0, 0.0, 0.0);
       glPushMatrix();
       glScalef (2.0, 0.4, 1.0);
       glutWireCube (1.0);
       glPopMatrix();
     
       glPushMatrix();
       glTranslatef(0, 0, -70.0f);
       glTranslatef (-1.0, 0.0, 0.0);
       glRotatef (-45, 0.0, 0.0, 1.0);
       glTranslatef (1.0, 0.0, 0.0);
       glPushMatrix();
       glScalef (2.0, 0.4, 1.0);
       glutWireCube (1.0);
       glPopMatrix();

    Result: http://img101.imageshack.us/i/75891671.jpg/ - this is what I need - figure < but it must be also solid so I have changed code:

    Code :
    glPushMatrix();
       glTranslatef(0, 0, -70.0f);
       glTranslatef (-1.0, 0.0, 0.0);
       glRotatef (45, 0.0, 0.0, 1.0);
       glTranslatef (1.0, 0.0, 0.0);
       glPushMatrix();
       glScalef(0.02, 1, 0.02);
       glutSolidCube(50);	
       glPopMatrix();
     
       glPushMatrix();
       glTranslatef(0, 0, -70.0f);
       glTranslatef (-1.0, 0.0, 0.0);
       glRotatef (-45, 0.0, 0.0, 1.0);
       glTranslatef (1.0, 0.0, 0.0);
       glPushMatrix();
       glScalef(0.02, 1, 0.02);
       glutSolidCube(50);
       glPopMatrix();

    but the final result is: http://img225.imageshack.us/i/57953116.jpg/
    left side first cube is in one place, and left side second cube is in different place - why ? It is figure X and I want figure < like previous.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: how can I make solid and wire frame cube ?

    What do u get if u just replace the glutWireCube to glutSolidCube in the first code like this.
    Code :
    glPushMatrix();
       glTranslatef(0, 0, -70.0f);
       glTranslatef (-1.0, 0.0, 0.0);
       glRotatef (45, 0.0, 0.0, 1.0);
       glTranslatef (1.0, 0.0, 0.0);
       glPushMatrix();
       glScalef (2.0, 0.4, 1.0);
       glutSolidCube (1.0);
       glPopMatrix();
     
       glPushMatrix();
       glTranslatef(0, 0, -70.0f);
       glTranslatef (-1.0, 0.0, 0.0);
       glRotatef (-45, 0.0, 0.0, 1.0);
       glTranslatef (1.0, 0.0, 0.0);
       glPushMatrix();
       glScalef (2.0, 0.4, 1.0);
       glutSolidCube (1.0);
    glPopMatrix();
    Regards,
    Mobeen

  6. #6
    Member Newbie
    Join Date
    Feb 2011
    Posts
    37

    Re: how can I make solid and wire frame cube ?

    Interesting - I have got that what I wanted - figure <, but when I have changed:
    Code :
    glutSolidCube (1.0);

    to

    Code :
    glutSolidCube (50.0);

    I have got figure X - what can I do ?

  7. #7
    Senior Member Regular Contributor
    Join Date
    Nov 2010
    Location
    Brazil, Rio de Janeiro
    Posts
    147

    Re: how can I make solid and wire frame cube ?

    Why 50.0 instead of 1.0?

  8. #8
    Member Newbie
    Join Date
    Feb 2011
    Posts
    37

    Re: how can I make solid and wire frame cube ?

    I can stay glutSolidCube (1.0);
    and use glScalef (15.0, 0.4, 1.0); - but the result is the same - bad

Similar Threads

  1. wire frame
    By mikeg in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-20-2004, 07:44 PM
  2. Wire Frame Rendering
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-27-2003, 11:03 AM
  3. Wire-Frame Mode
    By Stack Overflow in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-18-2002, 01:54 PM
  4. Wire shape works solid is screwed up
    By nukem in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-13-2002, 06:18 AM
  5. textures on a wire frame
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-25-2001, 10:43 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