source: trunk/packages/vizservers/nanovis/NvCamera.cpp @ 2844

Last change on this file since 2844 was 2836, checked in by ldelgass, 12 years ago

More cleanups, remove NEW_FLOW_ENGINE define flag

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ----------------------------------------------------------------------
4 * NvCamera.cpp : NvCamera class
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
10 *  Copyright (c) 2004-2006  Purdue Research Foundation
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16#include <stdio.h>
17
18#include <GL/glew.h>
19#include <GL/glu.h>
20
21#include "NvCamera.h"
22#include "Trace.h"
23
24NvCamera::NvCamera(int startx, int starty, int w, int h,
25                   float loc_x, float loc_y, float loc_z,
26                   float target_x, float target_y, float target_z,
27                   float angle_x, float angle_y, float angle_z) :
28    _location(loc_x, loc_y, loc_z),
29    _target(target_x, target_y, target_z),
30    _angle(angle_x, angle_y, angle_z),
31    _width(w),
32    _height(h),
33    _startX(startx),
34    _startY(starty)
35{
36}
37
38void
39NvCamera::initialize()
40{
41    TRACE("camera: %d, %d\n", _width, _height);
42    glViewport(_startX, _startY, _width, _height);
43    glMatrixMode(GL_PROJECTION);
44    glLoadIdentity();
45    gluPerspective(30,
46                   (GLdouble)(_width - _startX)/(GLdouble)(_height - _startY),
47                   0.1, 50.0);
48
49    glMatrixMode(GL_MODELVIEW);
50    glLoadIdentity();
51
52    gluLookAt(_location.x, _location.y, _location.z,
53              _target.x, _target.y, _target.z,
54              0., 1., 0.);
55
56    glRotated(_angle.x, 1., 0., 0.);
57    glRotated(_angle.y, 0., 1., 0.);
58    glRotated(_angle.z, 0., 0., 1.);
59}
60
Note: See TracBrowser for help on using the repository browser.