第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

具體代碼如下:為什么我用glutWireCube函數(shù)卻畫除了平面圖形,而不是立方體呢

具體代碼如下:為什么我用glutWireCube函數(shù)卻畫除了平面圖形,而不是立方體呢

#include <GL/glut.h>#include <stdlib.h>void display();void init();void display() { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glColor3f(1.0,0.0,0.0);glPushMatrix();glutWireCube(1.0);glPopMatrix();glutSwapBuffers();glFlush();} //init the windowvoid init() { glClearColor(1.0,1.0,1.0,1.0); glColor3f(0.0,0.0,0.0);glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(1.0,1.0,0.0,1.0,-1.0,1.0);}//the program starts hereint main(int argc,char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500,500); glutInitWindowPosition(0,0); glutCreateWindow("cube");init();glutDisplayFunc(display); glutMainLoop(); }
查看完整描述

2 回答

?
蠱毒傳說

TA貢獻1895條經(jīng)驗 獲得超3個贊

是立體圖形,只是你采用了平行投影來觀察,且視點設(shè)在與立方體的側(cè)面垂直的位置上,故只能看到一個面。 

建議改變視點,或者對立方體先做旋轉(zhuǎn)45度,


查看完整回答
反對 回復(fù) 2023-02-20
?
繁星點點滴滴

TA貢獻1803條經(jīng)驗 獲得超3個贊

幫你修改的代碼
#include <windows.h>  
#include <gl/glut.h>
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glPushMatrix();
glutWireCube(1.0);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
void reshape(int w, int h)
{
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0,(GLfloat)w/(GLfloat)h,1.0,20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0,0.0,-5.0);
}

int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow("cube");
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}


查看完整回答
反對 回復(fù) 2023-02-20
  • 2 回答
  • 0 關(guān)注
  • 171 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號