#include <GL/freeglut.h>
#include <stdlib.h>
void initGL(int iWidth, int iHeight)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)iWidth / (GLfloat)iHeight, 2.0f, 100.0f);
glMatrixMode(GL_MODELVIEW);
}
static void fnDisplay(void)
{
// initializarea sistemului de coordonate
glLoadIdentity();
glPushMatrix();
glTranslatef(0.0, 0.0, -10.0); // deplasat pe axele X, Y, Z
glRotatef(60.0, 1.0, 0.0, 0.0); // rotit cu 60 grade pe axa X
glRotatef(60.0, 0.0, 1.0, 0.0); // rotit cu 60 grade pe axa Y
glutSolidCube(2); // cub cu latura 2
glPopMatrix();
// forteaza executia codului
glFlush();
}
static void fnIdle(void)
{
glutPostRedisplay();
}
int main(int argc, char *argv[])
{
int
iWidth = 640, iHeight = 480;
//iWidth = 1024, iHeight = 768;
//iWidth = 1152, iHeight = 864;
//iWidth = 1280, iHeight = 960;
glutInit(&argc, argv);
glutInitWindowSize(iWidth, iHeight);
// afisarea ferestrei in centrul acranului
glutGet(GLUT_SCREEN_WIDTH);
glutGet(GLUT_SCREEN_HEIGHT);
glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH) - iWidth) / 2, (glutGet(GLUT_SCREEN_HEIGHT) - iHeight) / 2);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutCreateWindow("Laborator 1: Hello OpenGL World!");
glutDisplayFunc(fnDisplay);
glutIdleFunc(fnIdle);
initGL(iWidth, iHeight);
glutMainLoop();
return EXIT_SUCCESS;
}
GC.rar_computer
版权申诉
11 浏览量
2022-09-24
05:56:53
上传
评论
收藏 60KB RAR 举报
weixin_42653672
- 粉丝: 93
- 资源: 1万+
最新资源
- Picasso_v3.1 2.ipa
- chromedriver-mac-arm64.zip
- 蓝zapro.apk
- chromedriver-linux64.zip
- UCAS研一深度学习实验-MNIST手写数字识别python源码+详细注释(高分项目)
- 基于Python和PyTorch框架完成的一个手写数字识别实验源码(带MINIST手写数字数据集)+详细注释(高分项目)
- 基于Matlab在MNIST数据集上利用CNN完成手写体数字识别任务,并实现单层CNN反向传播算法+源代码+文档说明(高分项目)
- NVIDIA驱动、CUDA和Pytorch及其依赖
- 基于SVM多特征融合的微表情识别python源码+项目说明+详细注释(高分课程设计)
- html动态爱心代码一(附源码)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈