荒漠的英文译语怎么说-厦门培训中心
2023年4月5日发(作者:英语音标发音视频下载)
#include
/*DefinetheViewPortSize*/
#defineXVALUE400
#defineYVALUE300
#defineZVALUE200
intW_width=400,W_height=300;
intn=0,vert[100][2],type=GL_LINE_STRIP,v;
intrubberbanding,antialiasing;
enum{false,true};
voidSetupRc(void)
{
glC战国七雄实力排名 learColor非能水也 (0.0f,0.0f,0.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,XVALUE,0,YVALU饮酒陶渊明结庐在人境 E);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
}
voidRenderScene(void)
{
inti;
glClear(GL_COLOR_BUFFER_BIT);
if(n==1&&(type==GL_LINE_STRIP||type==GL_LINE_LOOP))
{
glBegin(GL_POINTS);
glVertex2iv(vert[0]);//DrawtheFirstandonlyvertexfor
polylineandclosedpolyline
glEnd();
}
glBegin(type);
for(i=0;i
glEnd();
glutSwapBuffers();//双缓冲区图形
绘制
}
voidReshape(intwidth,intheight)
{
floatw_aspect=4.0/3.0,aspect=((float)width)/height;
//视口保持w_aspect的纵横比
if(aspect<=w_aspect)
glViewport(0,(height-width/w_aspect)/2,width,width/w_aspect);
else
glViewport((width-height*w_aspect)/2,0,height*w_aspect,height);
//透视视窗转换
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,XVALUE,0,YVALUE);
}
voidKeyboard(unsignedcharkey,intx,inty)
{
switch(key)
{
case\'a\':antialiasing=!antialiasing;
if(antialiasing)
{
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
}
else
{
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
}
break;
case\'c\':n=0;break;
case\'l\':type=GL_LINE_STRIP;break;
case\'p\':type=GL_LINE_LOOP;break;
case\'v\':type=GL_POINTS;break;
}
glutPostRedisplay();
}
/*
*SpecialKeyCallBack
*/
voidSpecialKey(intkey,intx,inty)
{
if(glutGetModifiers()==(GLUT_ACTIVE_SHIFT|GLUT_ACTIVE_ALT))exit(0);
}
/*
*FindaVertexthatisnear(x,y)
*/
intfindVertex(intx,inty)
{
intdx,dy;
inti;
for(i=0;i
{
dx=vert[i][0]-x;
dy=vert[i][1]-y;
if(dx*dx+dy*dy<100)returni;//Returnitslocation
indexinvert
}
return(-1);//
Return-1ifnotfound
}
/*
*MouseCallBack
*/
voidMou暖的拼音 se(intbutton,intstate,intx,inty)
{
inti;
//Upperleftcorner=(0,0)
switch(button)
{
caseGLUT_LEF三峡能源 T_BUTTON:
if(state==GLUT_DOWN)
{
v=n++;
//Addanewvertex
vert[v][0]=x;
vert[v][1]=W_height-1-y;
rubberbanding=true;
//Startrubberbanding
glutPostRedisplay();
}
else
rubberbanding=false;
//Endrubberbanding
break;
caseGLUT_RIGHT_BUTTON:
if(state==GLUT_DOWN&&(v=findVertex(x,W_height-1-y))!=-1)
{
if(glutGetModifiers()==GLUT_ACTIVE_CTRL)
{
for(i=v;i
{
//Deltetvertexindexedbyv
vert[i][0]=vert[i+1][1];
}
n--;
}
else
{
vert[v][0]=x;
//Attachvertextocursor
vert[v][1]=W_height-1-y;
rubberbanding=true;//
Startrubberbanding
}
glutPostRedisplay();
}江南曲李益
elserubberbanding=false;//End
rubberbanding
break;
}
}
/*
*MotionCallBack
*/
voidMotion(intmouseX,intmouseY)
{
if(rubberbanding)
{
vert[v][0]=mouseX;
vert[v][1]=W_height-1-mouseY;
glutPostRedisplay();
}
}
/*
*PassiveCallBack
*/
voidPassive(i新春对联大全七字简单 ntmouseX,intmouseY)
{
intx,y;
//Upperleftcorner=(0,0)
x=mouseX;
y=W_height-1-mouseY;//Convertto
imagespacecoordinates
glutPostRedisplay();
}
/*
*MenuCallBack
*/
voidMenu(intitem)
{
switch(item)
{
case1:glCol茨威格简介及作品 or3f(1.0,0.0,0.0);break;
case2:glColor3f(0.0,1.0,0.0);break;
case3:glColor3f(0.0,0.0,1.0);break;
}
}
/*
*MainLoop
*/
intmain(intargc,char**argv)
{
glutInit(&argc,arg荷花的诗词 v);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);//Set
theDisplayMode
glutInitWindowSize(W_width,W_height);
//SettingWindowSize
glutInitWindowPosition(200,100);
//SettingWindowStartingPosition
glutCreateWindow(\"橡皮筋\");
//CreateaOpenGLWindow
SetupRc();
//SettheInitialDrawSence
glutDisplayFunc(RenderScene);
//theWindowDrawCallbackFunction
glutReshapeFunc(Reshape);
//theWindowChangeCallbackFunction
glutKeyboardFunc(Keyboard);
//theKeyboardCallbackFunction
glutSpecialFunc(SpecialKey);
//theSpecialCallbackFunction
glutMouseFunc(Mouse);
//Setmousebuttoneventfunction
glutMotionFunc(Motion);
//Setmousemovementfunction
glutPassiveMotionFunc(Passive);
//Setpassivemousemovementfunction
glutMainLoop();
//theWindowLoop
return0;
}
更多推荐
antialiasing是什么意思ialiasing在线翻译读
发布评论