本文整理汇总了C++中camera类的典型用法代码示例。如果您正苦于以下问题:C++ camera类的具体用法?C++ camera怎么用?C++ camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了camera类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void
camera_uniform_block::update(const render_context_ptr& context,
const camera& cam)
{
_uniform_block.begin_manipulation(context); {
_uniform_block->_ws_position = cam.position();
_uniform_block->_ws_near_plane = cam.view_frustum().get_plane(frustum::near_plane).vector();
_uniform_block->_p_matrix = cam.projection_matrix();
_uniform_block->_p_matrix_inverse = cam.projection_matrix_inverse();
_uniform_block->_v_matrix = cam.view_matrix();
_uniform_block->_v_matrix_inverse = cam.view_matrix_inverse();
_uniform_block->_v_matrix_inverse_transpose = cam.view_matrix_inverse_transpose();
_uniform_block->_vp_matrix = cam.view_projection_matrix();
_uniform_block->_vp_matrix_inverse = cam.view_projection_matrix_inverse();
} _uniform_block.end_manipulation();
}
开发者ID:4og,项目名称:schism,代码行数:16,代码来源:camera_uniform_block.cpp
示例2: generateImage
void image::generateImage(object mxdObject, camera m3dCamera, pose m34dPose)
{
this->mxdImage = m3dCamera.getIntrinsic() * m34dPose.getPoseMatrix() * mxdObject.getObjectPoints();
for (unsigned i = 0; i < this->mxdImage.cols(); i++)
{
this->mxdImage(0,i) = round(this->mxdImage(0,i)/this->mxdImage(2,i));
this->mxdImage(1,i) = round(this->mxdImage(1,i)/this->mxdImage(2,i));
this->mxdImage(2,i) = round(this->mxdImage(2,i)/this->mxdImage(2,i));
}
}
开发者ID:mdqyy,项目名称:Pose-Estimation,代码行数:11,代码来源:Image.cpp
示例3: if
void rasterized_color_triangle_app::on_key_down(SDL_Keysym const key)
{
app::on_key_down(key);
float const moving_speed{0.01f};
float const rotation_speed{0.05f};
if (key.sym == SDLK_a)
{
m_camera.move_left(moving_speed);
}
else if (key.sym == SDLK_d)
{
m_camera.move_right(moving_speed);
}
else if (key.sym == SDLK_w)
{
m_camera.move_forward(moving_speed);
}
else if (key.sym == SDLK_s)
{
m_camera.move_backward(moving_speed);
}
else if (key.sym == SDLK_r)
{
m_camera.move_up(moving_speed);
}
else if (key.sym == SDLK_f)
{
m_camera.move_down(moving_speed);
}
else if (key.sym == SDLK_q)
{
m_camera.yaw(-rotation_speed);
}
else if (key.sym == SDLK_e)
{
m_camera.yaw(rotation_speed);
}
else if (key.sym == SDLK_1)
{
m_shader_option = shader_option::color;
}
else if (key.sym == SDLK_2)
{
m_shader_option = shader_option::texture;
}
// Update model-view-projection according to camera changes
update_shader_mvp();
}
开发者ID:dubrousky,项目名称:lantern,代码行数:51,代码来源:main.cpp
示例4: mouseMove
/**
* Updates the camera based on the mouse movement.
*/
void mouseMove(int x, int y) {
dx = mouse_sensitivity * (p2wx(x) - lastx);
dy = mouse_sensitivity * (p2wy(g2py(y)) - lasty);
//dy = mouse_sensitivity * (p2wy(y) - lasty);
cam.update(cam.cam_spin_flag ? 0 : dx, dy);
//lastx = p2wx(x);
lasty = p2wy(g2py(y));
lasty = p2wy(y);
glutPostRedisplay();
}
开发者ID:Guinto,项目名称:Particle-System,代码行数:15,代码来源:main.cpp
示例5: detect
void blob_finder::detect(const camera &cam, const cv::Mat &mask, blobs_t &blobs)
{
detector.detect(mask, blobs);
for (auto &b : blobs)
{
b.cam = cam.i;
b.rel = cam.cam2rel(b.center);
auto pol = rect2pol(b.rel);
b.dist = pol.x;
b.angle = pol.y;
}
}
开发者ID:sim642,项目名称:Cryptex,代码行数:13,代码来源:blob_finder.cpp
示例6: generateImage
image generateImage(const camera& cam, const sceneGraphNode& sceneGraph, const lightsource_base& ls)
{
image result(cam.width(), cam.height());
result.clear();
// for every pixel
for(image::size_type y=0; y < result.height(); y++)
for(image::size_type x=0; x < result.width(); x++)
{
// create view ray
ray r = cam.generateViewRay(x, y);
// intersect
intersectionPoint ip = sceneGraph.intersect(r);
// if hit
if(ip.isHit())
result(x,y) = ip.evaluate(ls);
}
// Done.
return result;
}
开发者ID:Anaisabel95,项目名称:GraphicsClass,代码行数:23,代码来源:hw4.cpp
示例7: glGetIntegerv
void water::update(const float4x4& view_projection, const camera& camera, const point_light& light) {
// count normals
GLint old_viewport[4];
glGetIntegerv(GL_VIEWPORT, old_viewport);
glViewport(0, 0, grid_size_x_, grid_size_z_);
glDisable(GL_DEPTH_TEST);
norm_tex_->BeginRenderingToThisTexture();
glUseProgram(normal_prog_.program);
setUniform(normal_prog_.program, "objectMatrix", object_matrix_);
setUniform(normal_prog_.program, "inversedObjectMatrix", inversed_object_matrix_);
setUniform(normal_prog_.program, "gridSizeX", grid_size_x_);
setUniform(normal_prog_.program, "gridSizeZ", grid_size_z_);
bindTexture(normal_prog_.program, WATER_POSITIONS, "inPositions", pos_tex_[c_]->GetColorTexId());
full_screen_quad_->Draw();
norm_tex_->EndRenderingToThisTexture();
glEnable(GL_DEPTH_TEST);
glViewport(old_viewport[0], old_viewport[1], old_viewport[2], old_viewport[3]);
// draw water
glUseProgram(render_prog_.program);
setUniform(render_prog_.program, "cameraPosition", camera.get_pos());
setUniform(render_prog_.program, "viewProjectionMatrix", view_projection);
setUniform(render_prog_.program, "objectMatrix", object_matrix_);
light.setup_shader(render_prog_.program);
material_.setup_shader(render_prog_.program);
setUniform(render_prog_.program, "gridSizeX", grid_size_x_);
setUniform(render_prog_.program, "gridSizeZ", grid_size_z_);
bindTexture(render_prog_.program, WATER_POSITIONS, "inPositions", pos_tex_[c_]->GetColorTexId());
bindTexture(render_prog_.program, WATER_NORMALS, "inNormals", norm_tex_->GetColorTexId());
//glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
water_mesh_->Draw(GL_TRIANGLES);
glDisable(GL_BLEND);
}
开发者ID:tanyatik,项目名称:pool-caustics,代码行数:42,代码来源:water.cpp
示例8: main
int main(int argc, char** argv) {
int rc;
Shader s;
// set the camera to an initial position
cam.setCamera(Vector3f(0,-10,100), Vector3f(0,0,0), Vector3f(0,1,0));
glutInit(&argc, argv);
// glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH|GLUT_3_2_CORE_PROFILE);
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
glutInitWindowSize(600,600);
glutInitWindowPosition(10, 10);
glutCreateWindow("skybox");
glutDisplayFunc(renderFun);
glutIdleFunc(idleFun);
// setCallbackFun();
// initialize GLEW
// GLenum err = glewInit();
// if ( err != GLEW_OK) printf(" Error initializing GLEW! \n");
loadTextures();
skybox.init();
// skybox2.init();
Init_Geometry();
InitVBO();
rc = loadShaders(s);
if (rc != 0) {
printf("error after createing shaders rc = %d \n", rc);
getchar();
}
glutMainLoop();
}
开发者ID:ryanseys,项目名称:comp4002-assigns,代码行数:37,代码来源:main.cpp
示例9: renderScene
void renderScene(void){
//update the modelview matrix based on the camera's position
glMatrixMode(GL_MODELVIEW); //make sure we aren't changing the projection matrix!
glLoadIdentity();
glDrawBuffer( GL_BACK );
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport( 0, 0, windowWidth, windowHeight);
glPushMatrix();
myCam.set_atx(porsche.getX());
myCam.set_aty(porsche.getY());
myCam.set_atz(porsche.getZ());
myCam.set_eyex(porsche.getX());
myCam.set_eyez(porsche.getZ());
myCam.update_pos_arcball();
glPushMatrix(); {
sky->drawSkybox(200, 200, 200); // draw our axes so we know how we are oriented
}; glPopMatrix();
// draw ground
glPushMatrix(); {
drawGround();
}; glPopMatrix();
for (unsigned int i=0; i<cash.size(); i++){
glPushMatrix(); {
cash.at(i)->drawCrate();
};glPopMatrix();
}
// draw the car based on the world object coordinates controlled by user interaction
glPushMatrix(); {
glTranslatef(porsche.getX(), porsche.getY(), porsche.getZ());
glRotatef(porsche.getTheta(), 0.0, 1.0, 0.0); //Rotate about the y-axis
glTranslatef(-porsche.getX(), -porsche.getY(), -porsche.getZ());
porsche.drawCar(); // draw our dodecahedron...or torus...teapot...or whatever
}; glPopMatrix();
// draw the car based on the world object coordinates controlled by user interaction
for (unsigned int i=0; i<fuzz.size(); i++){
glPushMatrix(); {
glTranslatef(fuzz.at(i)->getX(), fuzz.at(i)->getY(), fuzz.at(i)->getZ());
glRotatef(fuzz.at(i)->getTheta(), 0.0, 1.0, 0.0);
glTranslatef(-fuzz.at(i)->getX(), -fuzz.at(i)->getY(), -fuzz.at(i)->getZ());
fuzz.at(i)->drawCar();
}; glPopMatrix();
}
glPopMatrix();
glClear(GL_FRAMEBUFFER | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glDisable(GL_LIGHTING);
glPushMatrix();
glOrtho(-1,1,-1,1,-1,1);
int locationX,locationY;
if (!gameOver){
locationX=-15;
locationY=windowHeight-windowHeight/12;
}else{
locationX=windowWidth/2;
locationY=windowHeight-windowHeight/2;
}
glViewport(locationX, locationY, windowWidth/12, windowHeight/12);
glLoadIdentity();
glColor3f(1,1,1);
char c[15];
sprintf(c, "%d", score);
string temp=string(c);
glRasterPos3i(0,0,0);
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'S');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'C');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'O');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'R');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'E');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, ':');
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, ' ');
for (unsigned int i=0; i<temp.size(); i++){
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, temp[i] );
}
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glPushMatrix();
glOrtho(-1,1,-1,1,-1,1);
if (!gameOver){
locationX=150;
locationY=windowHeight-windowHeight/12;
}else{
locationX=windowWidth/2;
locationY=windowHeight-windowHeight/2+windowWidth/12;
}
glViewport(locationX, locationY, windowWidth/12, windowHeight/12);
glLoadIdentity();
glColor3f(healthR,healthG,0);
char h[15];
sprintf(h, "%d", health);
//.........这里部分代码省略.........
开发者ID:tseale,项目名称:GTA-CarpetCity,代码行数:101,代码来源:main.cpp
示例10: render
void zombieType::render(int i,camera &cam,bool unrender)
{
animate();
oamSet(&oamMain, i+10, x-cam.getX(), y-cam.getY(), 0, 0, SpriteSize_32x32, SpriteColorFormat_256Color,
sprite_gfx_mem, -1, false, unrender, false, false, false);
}
开发者ID:Fronic,项目名称:LNoE,代码行数:6,代码来源:zombieType.cpp
示例11: main
int
main( int argc, char *argv[ ] )
{
cmd_args args;
if( !args.parse( argc, (const char**)argv ) ) {
return 1;
}
//setup glut
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA );
glutInitWindowSize( 640, 480 );
glutCreateWindow( "Flock of Birds Demo" );
//setup gl
init_gl( );
//set callbacks
glutKeyboardFunc( handle_keyboard );
glutReshapeFunc( handle_resize );
glutDisplayFunc( render );
glutIdleFunc( render );
#if ENABLE_FBB
fob::hemisphere hemisphere = fob::DOWN;
fob::port_speed speed = args.speed;
//talk to flock
flock.open( args.serial, hemisphere, speed, args.sleep_ms );
if( !flock ) {
std::cerr << "fatal: " << flock.get_error( ) << std::endl;
return 1;
}
//get a list of birds connected to the machine
fob::bird_list& birds = flock.get_birds( );
p_birds = &flock.get_birds( );
num_birds = birds.size( );
if( num_birds > MAX_ENTS ) num_birds = MAX_ENTS;
#else
unsigned int num_birds = 1;
#endif
#if ENABLE_FBB
//for each bird, set that we want position and orientation
for( unsigned int i = 0; i < birds.size( ); ++i ) {
if( !birds[ i ]->set_mode( fob::POSITION | fob::ORIENTATION | fob::BUTTONS ) ) {
std::cerr << "fatal: " << flock.get_error( ) << std::endl;
return 1;
}
}
#endif
//setup the camera
cam.set_position( 0.0, 100.0, 0.0 );
cam.set_look_right( math::vector3( 0.0, 0.0, 0.0 ), math::vector3::X_AXIS );
#if ENABLE_FBB
//set the flock flying
flock.fly( );
atexit( handle_exit );
//let the bird start up . . .
sleep( 1 );
#endif
//create the button sphere
sphere = gluNewQuadric( );
//start glut
glutMainLoop( );
//no errors
return 0;
}
开发者ID:Aye1,项目名称:RVProject,代码行数:75,代码来源:fly2.cpp
示例12: HandleEvents
void HandleEvents(SDL_Event e, float dt)
{
//User requests quit
if ( e.type == SDL_QUIT )
{
quit = true;
}
else if (e.type == SDL_KEYDOWN)
{
// handle key down events here
if (e.key.keysym.sym == SDLK_ESCAPE)
{
quit = true;
}
// rotate camera left
if (e.key.keysym.sym == SDLK_q)
{
Camera.rotateX(1 * dt);
}
// rotate camera right
if (e.key.keysym.sym == SDLK_e)
{
Camera.rotateX(-1 * dt);
}
//Camera.applyRotation();
// Move left
if (e.key.keysym.sym == SDLK_a)
{
Camera.strafe(10 * dt);
}
// move back
if (e.key.keysym.sym == SDLK_s)
{
Camera.translate(-10 * dt);
}
// move right
if (e.key.keysym.sym == SDLK_d)
{
Camera.strafe(-10 * dt);
}
// move forward
if (e.key.keysym.sym == SDLK_w)
{
Camera.translate(10 * dt);
}
if (e.key.keysym.sym == SDLK_y)
{
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
if (e.key.keysym.sym == SDLK_u)
{
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
if (e.key.keysym.sym == SDLK_z)
{
Camera.rotateY(-1 * dt);
}
if (e.key.keysym.sym == SDLK_x)
{
Camera.rotateY(1 * dt);
}
if (e.key.keysym.sym == SDLK_r)
{
Camera.flight(1 * dt);
}
if (e.key.keysym.sym == SDLK_f)
{
Camera.flight(-1 * dt);
}
}
else if (e.type == SDL_KEYUP)
{
if (e.key.keysym.sym == SDLK_w)
{
cout << "W RELEASED" << endl;
Camera.resetVerticalSpeed();
}
else if (e.key.keysym.sym == SDLK_s)
{
cout << "S RELEASED" << endl;
Camera.resetVerticalSpeed();
}
if (e.key.keysym.sym == SDLK_a || e.key.keysym.sym == SDLK_d)
{
Camera.resetHorizontalSpeed();
}
if (e.key.keysym.sym == SDLK_q || e.key.keysym.sym == SDLK_e)
{
// Reset Horizontal rotation
Camera.resetHorizontalRotation();
}
if (e.key.keysym.sym == SDLK_z || e.key.keysym.sym == SDLK_x)
{
//.........这里部分代码省略.........
开发者ID:doctorwk007,项目名称:OpenGL-and-GDAL-Tutorials,代码行数:101,代码来源:main.cpp
示例13: displayBoxFun
// RENDERS AN OBJECT USING A SKYBOX AS THE TEXTURE SOURCE
void displayBoxFun(GLuint shaderProg) {
Matrix4f viewMat, projMat, modelMat, m;
// set up the mode to wireframe
// setting up the transformaiton of the object from model coord. system to world coord.
modelMat = Matrix4f::identity();
//modelMat = Matrix4f::translation(0,0,0);
modelMat = Matrix4f::scale(50,50,50);
// ROATE THE OBJECT AROUND THE CAMERA VECTOR
// CAN ADD ROTATIONS AROUND THE PRIMARY AXIS
modelMat = modelMat * Matrix4f::rotateVector(cam.getLookAtVector(),angle,1);
// setting up the viewpoint transformation
viewMat = cam.getViewMatrix(NULL);
// setting up the projection transformation
projMat= cam.getProjectionMatrix(NULL);
// putting it all together
m = projMat * viewMat * modelMat;
// tell openfl which shader program to use
glUseProgram(shaderProg);
// transfer the modelViewProjection matrix to the shader
GLuint locMat= 0;
locMat=glGetUniformLocation(shaderProg, "modelViewProjMat");
glUniformMatrix4fv(locMat,1,1,(float *)m.vm);
// transfer the modelView matrix to the shader
m = viewMat * modelMat;
locMat=glGetUniformLocation(shaderProg, "modelViewMat");
glUniformMatrix4fv(locMat,1,1,(float *)m.vm);
// transfer the model matrix to the shader
m = modelMat;
locMat=glGetUniformLocation(shaderProg, "modelMat");
glUniformMatrix4fv(locMat,1,1,(float *)m.vm);
// load the camera position to the shader
locMat=glGetUniformLocation(shaderProg, "camPos");
Vector3f camPos = cam.getPosition();
glUniform3fv(locMat,1, (float *) &camPos);
// load the refract flag to the shader
locMat=glGetUniformLocation(shaderProg, "refractFlag");
glUniform1i(locMat, refractFlag);
glActiveTexture(GL_TEXTURE3);
GLuint texCube = skybox.getTexHandle();
glBindTexture(GL_TEXTURE_CUBE_MAP, texCube);
GLuint samLoc = glGetUniformLocation(shaderProg, "texCube");
glUniform1i(samLoc, 3);
GLint ttt = 0;
glGetUniformiv(shaderProg, samLoc, &ttt);
// bind the buffers to the shaders
GLuint positionLoc = glGetAttribLocation(shaderProg, "vertex_position");
GLuint normalLoc = glGetAttribLocation(shaderProg, "vertex_normal");
glEnableVertexAttribArray(positionLoc);
glEnableVertexAttribArray(normalLoc);
glBindBuffer(GL_ARRAY_BUFFER, vertex_handle);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, triangle_handle);
// Tells OpenGL how to walk through the two VBOs
struct sphereVertex v;
int relAddress = (char *) v.pos - (char *) &v;
glVertexAttribPointer(positionLoc,4,GL_FLOAT, GL_FALSE, sizeof(struct sphereVertex),(char*) NULL+relAddress);
relAddress = (char *) v.normal - (char *) &v;
glVertexAttribPointer(normalLoc,4,GL_FLOAT, GL_FALSE, sizeof(struct sphereVertex),(char*) NULL+relAddress);
// draw the triangles
glDrawElements(GL_TRIANGLES, numTriangles*3, GL_UNSIGNED_INT, (char*) NULL+0);
// glUseProgram(0);
// glUseProgram(shaderProg);
// draw the second sphere
modelMat = Matrix4f::identity();
//modelMat = Matrix4f::translation(0,0,0);
modelMat = Matrix4f::scale(50,50,50) * Matrix4f::translation(2, 0, 0);
// ROATE THE OBJECT AROUND THE CAMERA VECTOR
// CAN ADD ROTATIONS AROUND THE PRIMARY AXIS
modelMat = modelMat * Matrix4f::rotateVector(cam.getLookAtVector(),angle,1);
// setting up the viewpoint transformation
viewMat = cam.getViewMatrix(NULL);
// setting up the projection transformation
projMat= cam.getProjectionMatrix(NULL);
//.........这里部分代码省略.........
开发者ID:ryanseys,项目名称:comp4002-assigns,代码行数:101,代码来源:main.cpp
示例14: set_cornell_view
void set_cornell_view(camera &cam, int nx, int ny)
{
cam = camera(0.6981, float(nx)/float(ny));
cam.look_at(vec3(278, 278, -800), vec3(278,278,0));
}
开发者ID:skurmedel,项目名称:strahl0,代码行数:5,代码来源:strahl0.cpp
示例15: UIMethodsInit
void UIMethodsInit()
{
PosesInit();
nameHandler = new NameHandler();
fp = new vector< FixedPoint* >();
//hl = new HumanLeg( point( 0.0f, 50.0f, 0.0f ), point( 0.0f, 0.0f, 0.0f ), point( 1.0f, 1.0f, 1.0f ) );
//hlc = new HumanLegController( hl );
pl = new Player( point( ((float)width)/2.0f, ((float)height)/2.0f, 0 ), point( 0.0f, 0.0f, 0.0f ) );
selectedRect = new Rect( point( 0,0,0 ), point( 2000, 100, 0 ) );
float pos[WAMS_PLAYER_DOF];
pl->getPose( pos );
//hlc->getPose( pos );
keyframes.push_back( new Keyframe( pos, -1.0f ) );
count = 0;
cam.setLoc( 0, 0, -50 );
cam.setLookAt( 0, 0, 50 );
//cam2.setLoc( 0.0f, 300.0f, 0.0f );
//cam.setLookAt( 0, 100, 0 );
}
开发者ID:dtracers,项目名称:PumpAndJump,代码行数:19,代码来源:uimethods.cpp
示例16: overhead
void overhead(){
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDrawBuffer( GL_BACK );
glViewport(windowHeight-windowHeight/3,windowWidth-windowWidth/3,windowWidth/3,windowHeight/3);
glScissor(windowHeight-windowHeight/3,windowWidth-windowWidth/3,windowWidth/3,windowHeight/3);
glEnable(GL_SCISSOR_TEST);
glClearDepth(1.0);
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
glPushMatrix();
overheadCam.update_pos_arcball();
glPushMatrix(); {
sky->drawSkybox(200, 200, 200); // draw our axes so we know how we are oriented
}; glPopMatrix();
// draw ground
glPushMatrix(); {
drawGround();
}; glPopMatrix();
// draw the car based on the world object coordinates controlled by user interaction
glPushMatrix(); {
glTranslatef(porsche.getX(), porsche.getY(), porsche.getZ());
glColor3f(1,1,1);
glutSolidSphere(3, 10, 10);
};glPopMatrix();
for (unsigned int i=0; i<cash.size(); i++){
glPushMatrix(); {
glTranslatef(cash.at(i)->getX(),cash.at(i)->getY(),cash.at(i)->getZ());
glColor3f(0.6,0.4,0.2);
glutSolidCube(targsize);
};glPopMatrix();
}
for (unsigned int i=0; i<fuzz.size(); i++){
if (fuzz.at(i)->getY()>-10){
glPushMatrix(); {
glTranslatef(fuzz.at(i)->getX(), fuzz.at(i)->getY(), fuzz.at(i)->getZ());
if (fuzz.at(i)->inPursuit){
glColor3f(fuzz.at(i)->r,0,fuzz.at(i)->b);
}else{
glColor3f(0,0,0);
}
glutSolidSphere(3, 10, 10);
}; glPopMatrix();
}
}
glPopMatrix();
glMatrixMode(GL_PROJECTION);
}
开发者ID:tseale,项目名称:GTA-CarpetCity,代码行数:53,代码来源:main.cpp
示例17: drawScene
/**
* Draws the scene (used in display).
*/
void drawScene() {
glMatrixMode(GL_MODELVIEW);
glEnable(GL_DEPTH_TEST);
glPushMatrix(); {
cam.updateLookat();
for (unsigned int i = 0; i < objs.size(); i++) {
objs[i]->draw();
if (draw_arrows) {
glDisable(GL_DEPTH_TEST);
objs[i]->drawArrows();
glEnable(GL_DEPTH_TEST);
}
if (draw_bounding_box) {
objs[i]->drawBoundingBox();
}
if (follow && objs[i]->classId == PART_ID) {
particleSystem *temp = (particleSystem*)objs[i];
cam.setFocus(temp->pos);
}
}
} glPopMatrix();
}
开发者ID:Guinto,项目名称:Particle-System,代码行数:26,代码来源:main.cpp
示例18: drawScene
// Draws the scene
void drawScene()
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
// Camera
cam.look();
// Lights
light01.draw(); // Diffuse
light02.draw(false); // Ambient
// Object
ball01.draw();
glutSwapBuffers();
}
开发者ID:mohsend,项目名称:Magnificent-University-Projects,代码行数:15,代码来源:main.cpp
示例19: render
void render()
{
fr.SetCameraPos(Camera.getPos());
glm::mat4 view = Camera.getView();
glm::mat4 projection = Camera.getProjection();
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glClearColor( 0.f, 0.f, 0.5f, 0.f );
fr.render(view, projection);
GBuffer::BindForWriting();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glClearColor( 0.f, 0.f, 0.5f, 0.f );
Terrain.render(view, projection);
GBuffer::DefaultBuffer();
//glDisable(GL_CULL_FACE);
//glDisable(GL_DEPTH_TEST);
return;
}
开发者ID:doctorwk007,项目名称:OpenGL-and-GDAL-Tutorials,代码行数:24,代码来源:main.cpp
示例20: paintGL
void GLWidget::paintGL(){
glClearColor(0.1f, 0.1f, 0.1f, 0.0f);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(Camera.mPos.x, Camera.mPos.y, Camera.mPos.z,
Camera.mView.x, Camera.mView.y, Camera.mView.z,
Camera.mUp.x, Camera.mUp.y, Camera.mUp.z);
Camera.Mouse_Move();
Keyboard_Operations();
terra();
glEnable(GL_LIGHTING);
drawCube();
glDisable(GL_LIGHTING);
// Draw The Car
glColor3f(1,1,1);
glEnable(GL_LIGHTING);
glPushMatrix();
glTranslatef(20.0f,-3.0f,10.0f);
Auto->draw();
glPopMatrix();
glDisable(GL_LIGHTING);
rot+=1;
// Framerate control
int delay = time.msecsTo(QTime::currentTime());
if (delay == 0)
delay = 1;
time = QTime::currentTime();
timer->start(qMax(0, 30 - delay));
}
开发者ID:ismaelbonato,项目名称:OpenGLGame,代码行数:40,代码来源:glwidget.cpp
注:本文中的camera类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论