#include <stdio.h>
#include <gl/glut.h>
#include <math.h>
#include "gmath.h"
#include "gmatrix3d.h"
#include "gvector3d.h"
#include "gcamera.h"
GMatrix3d gRotMatrix;
double gRotx = 0.0;
double gRotY = 0.0;
bool gIsButtonDown = false;
int gMouseX = 0;
int gMouseY = 0;
GCamera gCamera;
void drawPlan()
{
glColor3f(0.6f,0.6f,0.6f);
glBegin(GL_LINES);
for(float u=-1.0f;u<1.01f;u+=0.2f)
{
glVertex3d(-1,0,u);
glVertex3d(1,0,u);
glVertex3d(u,0,-1);
glVertex3d(u,0,1);
}
glEnd();
}
void onDisplay()
{
glClearColor(1,1,1,1);
//清除缓存
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
gCamera.lookAt();
//glTranslated(0,0,-1.5);
glMultMatrixd(gRotMatrix);
glLineWidth(2);
drawPlan();
glPushMatrix();
glTranslatef(-0.3f,0,-0.3f);
glColor3f(1,0,0);
glutWireCube(0.4f);
glPopMatrix();
glPushMatrix();
glTranslatef(0.3f,0,-0.3f);
glColor3f(0,1,0);
glutWireSphere(0.2f,16,16
07-16
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交