المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : 3D Max - ثريدي ماكس محتاجه رسم روبوت ثلاثي ابعاد



سكون جرح
11-05-2013, 02:50 PM
السلام
عليكم ورحمة الله وبركاته ,,,
أنا محتاجه لرسم روبوت
باستخدام vertex array وهذا الشكل المطلوب في الصورة وهذا كود مبدئي من أمس
حايسه ماعرفت ارسم إلا مكعب

#include
<gl/glut.h>



GLfloat vertices[8][3]
=
{{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},
{1.0,1.0,-1.0},
{-1.0,1.0,-1.0},
{-1.0,-1.0,1.0}, {1.0,-1.0,1.0},
{1.0,1.0,1.0},
{-1.0,1.0,1.0}};
GLfloat colors[8][3]
=
{{0.0,0.0,0.0},{1.0,0.0,0.0},
{1.0,1.0,0.0},{0.0,1.0,0.0},
{0.0,0.0,1.0},{1.0,0.0,1.0},
{1.0,1.0,1.0},{0.0,1.0,1.0}};





GLubyte
cubeIndices[24] = { 0,3,2,1, /* Face 0 */
2,3,7,6, /* Face 1 */
0,4,7,3,
/* Face 2 */
1,2,6,5, /* Face 3 */
4,5,6,7, /* Face 4 */
0,1,5,4 }; /*
Face 5 */



void init(void)
{
glClearColor(1.0, 1.0, 1.0,
0.0); // set the background to white

glMatrixMode(GL_PROJECTION); // set
projection
parameters
glLoadIdentity();
glOrtho(-10.0,10.0,-10.0,10.0,-3,3);//&&&&&&&&&&&&&&&&&
glMatrixMode(GL_MODELVIEW);//&&&&&&&&&&&&&&&&&

}
void
myLine(void)
{

glClear( GL_COLOR_BUFFER_BIT );
glColor3f(1.0f,
0.0f, 0.0f);

}
void myDisplay(void)
{glClear( GL_COLOR_BUFFER_BIT
);

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT,
0, vertices);
glRotatef(45,1,1,0);
//&&&&&&&&&&&&&&&&&
for(int
i=0; i<6; i++)
glDrawElements(GL_POLYGON,
4,GL_UNSIGNED_BYTE,&cubeIndices[4*i]);
glDisableClientState(GL_VERTEX_ARRAY);

glBegin(GL_POLYGON);
glVertex3fv(vertices[0]);
glVertex3fv(vertices[3]);
glVertex3fv(vertices[2]);
glVertex3fv(vertices[1]);
glEnd();
/*void
colorcube(
)
{
polygon(0,3,2,1);
polygon(2,3,7,6);
polygon(0,4,7,3);
polygon(1,2,6,5);
polygon(4,5,6,7);
polygon(0,1,5,4);
}*/
glFlush();
//&&&&&&&&&&&&&&&&&
}
//-------------------------------------------------------------------

void
main( int argc, char **argv)
{
glutInit(&argc, argv); // Initialize
GLUT
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB ); // Set display
mode
glutInitWindowPosition(100,200); // Set top-left display window
position
glutInitWindowSize(500,500); // Set display window width and
height
glutCreateWindow("An Example");// Create display
window
glEnableClientState(GL_COLOR_ARRAY);

glColorPointer(3,
GL_FLOAT, 0, colors);

init(); // Execute initialization
procedure
glutDisplayFunc(myDisplay);

glutMainLoop(); // Display
everything and wait
}

.....الله يسعدكم
إذا احد يعرف يفيدني محتاجته اليووووووووووووووم
ضروووررررررري

http://www.montada.com/attachment.php?attachmentid=357276&stc=1&thumb=1&d=1368253094 (http://www.montada.com/attachment.php?attachmentid=357276&d=1368253094)

K.F.U.P.M
15-05-2013, 10:05 PM
و أنتي ليش ترسمينه بالأوبن جل بدل ما تستخدمين برنامج تصميم؟