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
If you wanna draw your entire scene in wireframe you can use
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
before your draw calls.
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:
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:
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.
What do u get if u just replace the glutWireCube to glutSolidCube in the first code like this.
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();
Interesting - I have got that what I wanted - figure <, but when I have changed:
glutSolidCube (1.0);
to
glutSolidCube (50.0);
I have got figure X - what can I do ?
Why 50.0 instead of 1.0?
I can stay glutSolidCube (1.0);
and use glScalef (15.0, 0.4, 1.0); - but the result is the same - bad