【问题标题】:draw 2d line with 3d effect with openGL by using Qt on Android (and iOS)在 Android(和 iOS)上使用 Qt 使用 openGL 绘制具有 3d 效果的 2d 线
【发布时间】:2016-12-15 01:50:21
【问题描述】:

在我的应用程序中,我的屏幕上有 10k ~ 200k 行。并且线条是在具有 3d 效果的 2d 空间中绘制的。

我想通过使用 Qt 来加快我在 iOS 和 Android 上的绘图速度。 因此,我想在 Qt 上尝试 openGL。

我尝试了一个非常简单的代码: https://github.com/mkdh/Qt_QOpenGLWidget_screen_test.git

它应该在我的 Android 上显示绿屏,但在我的 Android 上显示白屏。 你知道为什么它在我的Android上显示白屏吗?如果我想在这个 Android 上使用 openGL,我该怎么办?

创建者的应用程序输出:

InputMethodManagerService( 536): Enabling: SessionState{uid 10287 pid 25474 method 224d6020 session 2250c900 channel ClientState{22861db8 uid 10287 pid 25474} (server)}
W/My First openGL Widget(25474): (null):0 ((null)): Cannot find EGLConfig, returning null config
W/My First openGL Widget(25474): (null):0 ((null)): QEGLPlatformContext: Failed to create context: 3005
W/My First openGL Widget(25474): (null):0 ((null)): Cannot find EGLConfig, returning null config
W/My First openGL Widget(25474): (null):0 ((null)): QEGLPlatformContext: Failed to create context: 3005
W/My First openGL Widget(25474): (null):0 ((null)): QOpenGLWidget: Failed to create context
W/My First openGL Widget(25474): (null):0 ((null)): Cannot find EGLConfig, returning null config
W/My First openGL Widget(25474): (null):0 ((null)): QEGLPlatformContext: Failed to create context: 3005
W/My First openGL Widget(25474): (null):0 ((null)): QOpenGLWidget: Failed to create context
W/My First openGL Widget(25474): (null):0 ((null)): Cannot find EGLConfig, returning null config
W/My First openGL Widget(25474): (null):0 ((null)): QEGLPlatformContext: Failed to create context: 3005
W/My First openGL Widget(25474): (null):0 ((null)): QOpenGLWidget: Failed to create context
W/My First openGL Widget(25474): (null):0 ((null)): composeAndFlush: makeCurrent() failed
W/My First openGL Widget(25474): (null):0 ((null)): composeAndFlush: makeCurrent() failed

对了,为什么我不能在 void MyGLWidget::initializeGL() 中用 glBegin(GL_LINES) 作为注释画线?

【问题讨论】:

    标签: android c++ qt opengl-es


    【解决方案1】:

    我建议你使用NanoVG 而不是非常复杂的纯OpenGL。您在 OpenGL 上的代码与特定版本的 OpenGL 相关联,这可能会导致许多可移植性问题。 NanoVG 是基于 OpenGL(2,es,es2,es3) 的画布绘图 API,具有类似 HTML5 的画布 API。还有一个 Qt 与 NanoVG 的集成,即 QNanoPainter。

    在 linux、windows 和 android 上也支持。

    【讨论】:

    • 这不是我想要使用的另一个 OpenGL 工具。 QNanoPainter 似乎不是 Qt 的官方功能。我可以通过注释下面的代码来解决这个问题。 // format.setVersion(3, 2); // format.setProfile(QSurfaceFormat::CoreProfile);
    【解决方案2】:

    我可以通过注释下面的代码来解决这个问题。

    // format.setVersion(3, 2);

    // format.setProfile(QSurfaceFormat::CoreProfile)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-17
      • 2011-02-25
      相关资源
      最近更新 更多