OpenGL 'reshape()'函数视口边框背景
OpenGL 'reshape()' function Viewport Border Background
我在OpenGL 3.2+程序中使用Win32创建了一个窗口,我正在试验一些东西。目前,我正在使用下面的reshape()
函数来调整窗口大小等。
中添加了一个边框,因此它在视口周围留下了一个 50px 的边框,这符合我的预期。
void reshape(int width, int height, int pers_Dist)
{
screenWidth = width;
screenHeight = height;
float border = 50;
glViewport(0+border,0+border,width-(border*2),height-(border*2));
MatrixRoutines<float>::perspective(pers_Dist, (GLfloat)screenWidth/(GLfloat)screenHeight, 1, 200, ProjectionMatrix);
}
背景颜色在init()
函数中使用:glClearColor(0.0,0.0,0.0,0.0);
、 黑色进行设置。
我的问题是,可以将边框分配给背景不同的颜色吗?(如果我更改颜色,背景和边框始终是颜色集)。
使用剪刀区域告诉 OpenGL 清除位置:
-
glDisable( GL_SCISSOR_TEST )
- 使用边框颜色清除
- 将剪刀设置为边框区域
-
glEnable( GL_SCISSOR_TEST )
- 内色透明
- 渲染场景
相关文章:
- C++win32 API创建多个类似视口的窗口
- 使用C++在Qt3D中创建多个视口时出现问题
- 创建具有两个视口的Qt3D C++场景,其中显示适当的不同网格
- 尝试在虚幻引擎中通过C++添加视口时出错"No instance of overloaded function CreateWidget"
- 无法添加视口虚幻C
- C++ GLUT 使对象在视口外消失
- 如何在单独的视口和默认的framebuffer中使用framebuffer
- 在 C++.NET 中使用 OpenGL 并在视口上绘画
- VTK 定位摄像机以用对象填充视口
- 在 opengl 中视口的一角绘制世界坐标系
- 如何在 SDL2.0 OpenGL 中调整视口大小
- 在显示之前获取 QScrollArea 视口的大小
- 视口内的 OpenGL 视口
- MRPT:可以从视口获取图像
- OpenGL 'reshape()'函数视口边框背景
- OpenGL:多个重叠视口闪烁
- 如何为视口应用程序重新采样图像的子区域
- Opengl和DirectX视口和渲染目标
- 从视口坐标转换为[-1,1]^2顶点[ENGGL]
- OpenGL 3/GLFW空白视口