《基于MFC的OpenGL编程》Part 1 A Primer
来源:百度文库 编辑:神马文学网 时间:2024/04/27 16:20:14
2008年12月30日
关键字:
《基于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程序
//Simple.cpp-FirstOpenGLProgram
#include//RequiredforeveryWindowsProgram
#include//RequiredforusingtheGLUTlibrary
//PerformOpenGLInitializationhere
voidSetupRC()
{
//Setthebackgroundclearingcolortoblue
glClearColor(0.0f,0.0f,1.0f,1.0f);//设置背景色为蓝色
}
//Thedrawingcallbackfunction
voidRenderScene()
{
//Clearthecolorbuffer
glClear(GL_COLOR_BUFFER_BIT);
//Flushtherenderingpipeline
glFlush();
}
voidmain()
{
//Choosethedisplaymodesettings
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);//初始化显示模式(单缓冲,RGB)
//CreatetheWindow
glutCreateWindow("Simple");//创建窗口
//SettheRenderScsnefunctionasthedisplaycallback
glutDisplayFunc(RenderScene);//绘制回调函数,当窗口需要绘制时,GLUT会调用此函数
//InitializeOpenGL
SetupRC();//初始化OpenGL
//StarttheGLUTframework
glutMainLoop();//开始消息循环
}
来源:博客园 作者:Phinecos(洞庭散人)
关键字:
《基于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程序
//Simple.cpp-FirstOpenGLProgram
#include
#include
//PerformOpenGLInitializationhere
voidSetupRC()
{
//Setthebackgroundclearingcolortoblue
glClearColor(0.0f,0.0f,1.0f,1.0f);//设置背景色为蓝色
}
//Thedrawingcallbackfunction
voidRenderScene()
{
//Clearthecolorbuffer
glClear(GL_COLOR_BUFFER_BIT);
//Flushtherenderingpipeline
glFlush();
}
voidmain()
{
//Choosethedisplaymodesettings
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);//初始化显示模式(单缓冲,RGB)
//CreatetheWindow
glutCreateWindow("Simple");//创建窗口
//SettheRenderScsnefunctionasthedisplaycallback
glutDisplayFunc(RenderScene);//绘制回调函数,当窗口需要绘制时,GLUT会调用此函数
//InitializeOpenGL
SetupRC();//初始化OpenGL
//StarttheGLUTframework
glutMainLoop();//开始消息循环
}
来源:博客园 作者:Phinecos(洞庭散人)
《基于MFC的OpenGL编程》Part 1 A Primer
《基于MFC的OpenGL编程》Part 10 Texture Mapping
《基于MFC的OpenGL编程》Part 9 Lighting
《基于MFC的OpenGL编程》Part 2 Setting up OpenGL on Windows
基于MFC下的OpenGL框架
基于VC++的OpenGL编程讲座之概述
基于VC++的OpenGL编程讲座之坐标变换
基于VC++的OpenGL编程讲座之概述
基于VC++的OpenGL编程讲座之基本图元
手把手教你搭建用MFC进行OpenGL编程的框架
如何让基于对话框的MFC程序启动后自动隐藏对话框--==>肯肯编程小屋<==
OpenGL的安装 - OpenGL
MFC ODBC 编程
MFC中基于对话框程序快捷键的实现
MFC中基于对话框程序快捷键的实现
如何让基于对话框的MFC程序启动后自动隐藏对话框 VC/MFC / 界面
MFC 对话框编程要点 - lesky的专栏 - CSDNBlog
VC知识库文章 - MFC程序员的WTL指南: Part I - ATL 界面类
VC知识库文章 - MFC程序员的WTL指南: Part II - WTL 界面基类
VC知识库文章 - MFC程序员的WTL指南: Part III - 工具条与状态条
VC知识库文章 - MFC程序员的WTL指南: Part IV - 对话框与控件
VC知识库文章 - MFC程序员的WTL指南: Part VII - 分隔窗口
[爱情的傻子 part of a fool]
A survey of XML standards: Part 1