1 // qtcapture.cpp
2 //
3 // Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9
10 #include <cmath>
11
12 #include "../src/celengine/gl.h"
13 #include "../src/celengine/glext.h"
14
15 #include <celutil/debug.h>
16 #include "qtcapture.h"
17
18 using namespace std;
19
20
QTCapture()21 QTCapture::QTCapture() :
22 width(-1),
23 height(-1),
24 frameRate(30.0f),
25 frameCounter(0),
26 capturing(false)
27 {
28 }
29
30
~QTCapture()31 QTCapture::~QTCapture()
32 {
33 cleanup();
34 }
35
36
start(const string & filename,int w,int h,float fps)37 bool QTCapture::start(const string& filename,
38 int w, int h,
39 float fps)
40 {
41 if (capturing)
42 return false;
43
44 width = w;
45 height = h;
46 frameRate = fps;
47
48 capturing = true;
49 frameCounter = 0;
50
51 return true;
52 }
53
54
end()55 bool QTCapture::end()
56 {
57 capturing = false;
58 cleanup();
59
60 return true;
61 }
62
63
captureFrame()64 bool QTCapture::captureFrame()
65 {
66 if (!capturing)
67 return false;
68
69 // Get the dimensions of the current viewport
70 GLint viewport[4];
71 glGetIntegerv(GL_VIEWPORT, viewport);
72
73 int x = viewport[0] + (viewport[2] - width) / 2;
74 int y = viewport[1] + (viewport[3] - height) / 2;
75
76 frameCounter++;
77
78 return true;
79 }
80
81
cleanup()82 void QTCapture::cleanup()
83 {
84 }
85
86
getWidth() const87 int QTCapture::getWidth() const
88 {
89 return width;
90 }
91
getHeight() const92 int QTCapture::getHeight() const
93 {
94 return height;
95 }
96
getFrameRate() const97 float QTCapture::getFrameRate() const
98 {
99 return frameRate;
100 }
101
getFrameCount() const102 int QTCapture::getFrameCount() const
103 {
104 return frameCounter;
105 }
106
setAspectRatio(int aspectNumerator,int aspectDenominator)107 void QTCapture::setAspectRatio(int aspectNumerator, int aspectDenominator)
108 {
109 }
110
setQuality(float)111 void QTCapture::setQuality(float)
112 {
113 }
114
recordingStatus(bool started)115 void QTCapture::recordingStatus(bool started)
116 {
117 }
118