本文整理汇总了C++中GLFrustum::SetOrthographic方法的典型用法代码示例。如果您正苦于以下问题:C++ GLFrustum::SetOrthographic方法的具体用法?C++ GLFrustum::SetOrthographic怎么用?C++ GLFrustum::SetOrthographic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLFrustum
的用法示例。
在下文中一共展示了GLFrustum::SetOrthographic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeSize
void ChangeSize(int w, int h) {
GLfloat nRange = 500.0f;
windowWidth = w;
windowHeight = h;
// Verhindere eine Division durch Null
if (h == 0) {
h = 1;
}
// Setze den Viewport gemaess der Window-Groesse
glViewport(0, 0, w, h);
// Ruecksetzung des Projection matrix stack
projectionMatrix.LoadIdentity();
if (bPerspectiveProj) {
// Definiere das viewing volume (left, right, bottom, top, near, far)
if (w <= h) {
viewFrustum.SetPerspective(30.0f, h/w, 1, 3000);
}
else {
viewFrustum.SetPerspective(30.0f, w / h, 1, 3000);
}
}
else {
// Definiere das viewing volume (left, right, bottom, top, near, far)
if (w <= h) {
viewFrustum.SetOrthographic(-nRange, nRange, -nRange*h / w, nRange*h / w, -nRange, nRange);
}
else {
viewFrustum.SetOrthographic(-nRange*w / h, nRange*w / h, -nRange, nRange, -nRange, nRange);
}
}
projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
// Ruecksetzung des Model view matrix stack
modelViewMatrix.LoadIdentity();
TwWindowSize(w, h);
}
示例2: ChangeSize
void ChangeSize(int w, int h)
{
// Prevent a divide by zero
if(h == 0)
h = 1;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
// Establish clipping volume (left, right, bottom, top, near, far)
viewFrustum.SetOrthographic(0.0f, SCREEN_X, 0.0f, SCREEN_Y, -1.0f, 1.0f);
}
示例3: ChangeSize
void ChangeSize(int w, int h)
{
// Prevent a divide by zero
if(h == 0)
h = 1;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
viewFrustum.SetOrthographic(-130.0f, 130.0f, -130.0f, 130.0f, -130.0f, 130.0f);
projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());
transformPipeline.SetMatrixStacks(modelViewMatix, projectionMatrix);
}