我已经提供了以下代码.当我重载一个重载的后缀运算符时,编译器抛出错误.它在重载的前缀运算符上工作正常.错误
error: no match for ‘operator<<’ in ‘std::cout << cDigit.Digit::operator++(0)’
Run Code Online (Sandbox Code Playgroud)
码
#include <iostream>
using namespace std;
class Digit
{
private:
int m_nDigit;
public:
Digit(int nDigit=0)
{
m_nDigit = nDigit;
}
Digit& operator++(); // prefix
Digit& operator--(); // prefix
Digit operator++(int); // postfix
Digit operator--(int); // postfix
friend ostream& operator<< (ostream &out, Digit &digit);
int GetDigit() const { return m_nDigit; }
};
Digit& Digit::operator++()
{
// If our number is already at 9, wrap around to 0
if (m_nDigit == 9) …Run Code Online (Sandbox Code Playgroud) 注意我是 Android 和 OpenGL 的新手。
我使用代码在屏幕上显示 Android 相机预览。我想在下面的“MainRenderer”类中使用 OpenGL 2.0(以匹配我的相机的纵向分辨率,因为我的应用程序处于纵向模式)将相机角度旋转 90 度。我已经研究过Android 相机旋转,但它没有执行旋转。
在布局 xml 中设置“android:rotation='90'”会旋转表面视图但会产生黑色表面 - 没有相机预览。
由于我使用 GLSurfaceView,我现在希望通过执行矩阵旋转和纵横比调整来实际旋转 OpenGL 2.0 中的相机预览。像如何在 OpenGL 2.0 ES 和http://www.programcreek.com/java-api-examples/index.php?class=android.opengl.Matrix&method=rotateM 中旋转相机视图这样的帖子很少 , 但我无法联系由于我不熟悉 OpenGL(我希望很快熟悉),因此使用以下代码的 API。
我知道也许rotateM 和translateM(猜测使用ModelViewProjection Matrix)可能会做我打算完成的事情。
我想知道下面可能需要更改 vtmp 和 ttmp 吗?
任何帮助表示赞赏。
原始代码来自http://maninara.blogspot.com/2012/09/render-camera-preview-using-opengl-es.html
// 在清单中
< uses-feature android:glEsVersion="0x00020000" android:required="true"/>
< uses-feature android:name="android.hardware.camera"/>
< uses-permission android:name="android.permission.CAMERA"/>
< uses-permission android:name="android.permission.WAKE_LOCK"/>
... android:screenOrientation="landscape" ... // activity property
Run Code Online (Sandbox Code Playgroud)
// 活动
public class MainActivity extends Activity {
private …Run Code Online (Sandbox Code Playgroud) 我在Ubuntu 10.04上使用gtkmm2.4.(因此我的示例包含on_expose_event()例程而不是on_draw()).似乎VBox中没有窗口引用on_expose_event()中的get_window().我必须添加它吗?
原始代码http://developer.gnome.org/gtkmm-tutorial/2.22/gtkmm-tutorial.html#sec-drawing-clock-example
我的代码是
test.h
#ifndef TEST_H
#define TEST_H
#include <gtkmm.h>
class TEST : public virtual Gtk::Window
{
private:
public:
TEST();
virtual ~TEST();
protected:
Gtk::VBox V; // Make V Box
Gtk::HBox H1; // Upper H Box
Gtk::HBox H2; // Lower H Box
class Clock : public virtual Gtk::DrawingArea
{
public:
Clock();
virtual ~Clock();
protected:
//Override default signal handler:
virtual bool on_expose_event(GdkEventExpose* event);
double m_radius;
double m_lineWidth;
bool onSecondElapsed(void);
Glib::RefPtr<Gdk::Window> m_refGdkWindow;
};
};
#endif // TEST_H
Run Code Online (Sandbox Code Playgroud)
test.cc
#include <ctime>
#include …Run Code Online (Sandbox Code Playgroud) 目前我可以在视频流上显示当地时间文本(时钟叠加)。
gst-launch-1.0 v4l2src ! videoconvert ! 'video/x-raw,width=640,height=480' ! clockoverlay ! ximagesink
我正在努力寻找一种显示当前日期的方法(假设本地时区)。
我确信我可以通过编写自己的插件来做到这一点。但是,是否有库存或变通方法可以避免重新发明轮子?有任何想法吗?