前面哪个opengl程序实际上已经快成功了,只差一点点了。
发现只要前、后图对换,左、右图对换就可以了
所以这里除了对换外,把哪个要按2次键才能截到正确的图也改一下(延时)
具体看代码吧:
//53 全景球贴图 切分6图
//左键(+ 移动)旋转,右键(+ 移动)缩放 1,2,3,4 切换地图,回车键(enter)全屏切换,按w、a、s、d、f、x、切换视角并截图
#pragma comment( lib, "opengl32.lib" )
#pragma comment( lib, "glut32.lib")
#include <GL/glut.h>
#include <GL/glu.h>
#include <math.h>
#include <cstdlib>
#include <string>
#include "ArcBall.h"
#include "Sky.h"
CSky m_sky;
void setWidthHeight(GLint width ,GLint height);
void screenshot(char* FileName); //全窗口
int BuildTexture(char *szPathName, GLuint &texid);
//初始化,必须用全局变量的方式,不能用new
ArcBallT arcBall(600.0f,400.0f);
ArcBallT* ArcBall =&arcBall;// new ArcBallT(600.0f,400.0f);//&arcBall;
#define PI 3.141592654
GLuint SkyTexture[10];//纹理
int width,height;//屏幕宽高
int R=100;//地图球半径
std::string direction;//方向
bool Shot=false;
void reshape(int w, int h){
glViewport(0,0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//GLdouble zNear=R*cos(PI/2);
gluPerspective(90.0f, (GLfloat)w / (GLfloat)h, 6.5f, R*2);//zNear
glMatrixMode(GL_MODELVIEW);
ball
ArcBall->setBounds((GLfloat)w, (GLfloat)h);//1. 设置窗口边界
}
void init(){
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glD