《基于MFC的OpenGL编程》Part 1 A Primer
3D图形学基本概念
Perspective
Perspective refers to the angles between the lines that lend the illusion of three dimensions.
Colors and Shading
Moving beyond line drawing, we need to add color to create a solid object. Shading refers to the way the color is applied to the polygon. Shading can be of two types in OpenGL - Flat or Smooth.
Lights and Shadows
Plain solid color doesn’t offer enough realism. By applying Lighting effects we can make objects appear as they would in reality depending on their material properties and the lighting parameters. Adding a shadow further increases realism.
Texture Mapping
With Texture Mapping we can have wood grains, cloth textures, brick like textures etc instead of plain materials. This technique of applying an image to the surface of a polygon is called Texture Mapping. The image we use is called the Texture and the individual elements of the texture are called Texels.
Fog
Fog is an atmospheric effect that adds haziness to objects in a scene depending on how far the objects are from the viewer.
Blending and Transparency
Blending is the combination of colors of objects on the screen. This effect can be used for a variety of purposes. By varying the amount each object is blended with the scene we can make objects look transparent.
Anti-Aliasing
Aliasing is an effect that is visible on screen due to the fact that an image consists of discrete pixels. By carefully blending the lines with the background color we can eliminate jagged edges and give them a smooth appearance. This blending technique is called anti-aliasing.
第一个OpenGL程序
#include <windows.h> //Required for every Windows Program
#include <gl\glut.h> //Required for using the GLUT library
//Perform OpenGL Initialization here
void SetupRC()
{
//Set the background clearing color to blue
glClearColor(0.0f,0.0f,1.0f,1.0f);//设置背景色为蓝色
}
//The drawing callback function
void RenderScene()
{
//Clear the color buffer
glClear(GL_COLOR_BUFFER_BIT);
//Flush the rendering pipeline
glFlush();
}
void main()
{
//Choose the display mode settings
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);//初始化显示模式(单缓冲,RGB)
//Create the Window
glutCreateWindow("Simple");//创建窗口
//Set the RenderScsne function as the display callback
glutDisplayFunc(RenderScene);//绘制回调函数,当窗口需要绘制时,GLUT会调用此函数
//Initialize OpenGL
SetupRC();//初始化OpenGL
//Start the GLUT framework
glutMainLoop();//开始消息循环
}
作者:洞庭散人
出处:http://phinecos.cnblogs.com/
posted on 2008-11-04 21:15 Phinecos(洞庭散人) 阅读(14726) 评论(3) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· SQL Server 2025 AI相关能力初探
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
2007-11-04 每日阅读(四)