Uruchamianie OpenGL w Linux

0

Posiadam Ubuntu w wersji 12.10 i Qt w wersji 5.0.2.

Zainstalowałem Qt Creator na tym systemie, potem doinstalowałem g++ i libglu1-mesa-dev za pomocą apt-get.

Otworzyłem program wykorzystujący OpenGL, który działa pod Windows, chciałem sprawdzić, jak będzie działać na Linux.

Po zainstalowaniu g++ i libglu1-mesa-dev program bez problemu się skompilował, ale przy próbie uruchomienia pojawia się błąd przedstawiony w załączniku.

Co może być tego przyczyną i jak rozwiązać?

Sam program to ten http://4programmers.net/Forum/C_i_C++/218626-problem_z_glebokoscia_w_openglqt , tylko przedstawiony tam problem udało mi się rozwiązać, a sam program uprościłem i ulepszyłem.

0

Spróbowałem z debuggerem i mam to, co na screenach, nie wiem, czy to coś mówi i czy coś interesującego można jeszcze wyciągnąć. Po skompilowaniu i uruchomieniu w trybie "release" tak samo program się nie uruchamia. Wygaszacze ekranu 3D działają, co sugeruje, że nie ma problemów z samym OpenGL.

0

A może jednak jest jakiś problem. Poszukaj jakiegoś HelloWorld OpenGL i odpal. Na VMce może być ciężko z akceleracją.

0

Aah, to jest VM.
a "Guest Additions" czy jak to się tam nazywa w Virtual Boksie, zainstalowane?

Najlepiej te które są dołączone do programu, a nie te które masz w systemie gościa domyślnie albo do wyboru w repozytorium.

0

Zainstalowałem dodatki właśnie te, które są na wyposażeniu VirtualBox i program też się nie uruchamia, ale przy próbie uruchamiania pojawia się taki log:

Uruchamianie /home/xxx/Pulpit/OpenGlTest/build-OpenGlTest-Desktop_Qt_5_0_2_GCC_32bit-Debug/OpenGlTest...
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x9d868c8
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x9d868c8, failed to get XVisualInfo
ASSERT: "QOpenGLFunctions::isInitialized(d_ptr)" in file ../../../Qt5.0.2/5.0.2/gcc/include/QtGui/qopenglfunctions.h, line 749
Program nieoczekiwanie przerwał pracę.
/home/xxx/Pulpit/OpenGlTest/build-OpenGlTest-Desktop_Qt_5_0_2_GCC_32bit-Debug/OpenGlTest zakończone kodem 0

Skompilowałem i uruchomiłem program "cube" dołączony do Qt jako przykład i program działa idealnie.

Wracając do mojego programu, jak się w procedurze "DrawRectangle" zakomentuje wszystkie linie oprócz "glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);", to program się uruchamia, tylko, że nie pokazuje obrazu.

Jak się nawet zakomentuje całą treść metody "paintGl", to po uruchomieniu aplikacji w logu jest takie coś:

Uruchamianie /home/xxx/Pulpit/OpenGlTest/build-OpenGlTest-Desktop_Qt_5_0_2_GCC_32bit-Debug/OpenGlTest...
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8c23720
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0x8c23720, failed to get XVisualInfo
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
/home/xxx/Pulpit/OpenGlTest/build-OpenGlTest-Desktop_Qt_5_0_2_GCC_32bit-Debug/OpenGlTest zakończone kodem 0

W tym programie najważniejsza jest klasa "TestWidget", której pełny kod jest poniżej, opisane powyżej zakomentowywanie fragmentów kodu dotyczy właśnie tego ponizszego kodu:

#ifndef TESTWIDGET_H
#define TESTWIDGET_H

#include <QWidget>
#include <QGLWidget>
//#include <GL/glu.h>


#include <QOpenGLShaderProgram>
#include <QOpenGLFunctions>

class TestWidget : public QGLWidget, protected QOpenGLFunctions
{
    Q_OBJECT
public:
    explicit TestWidget(QWidget *parent = 0);

    void initializeGL();
    void resizeGL(int w, int h);
    void paintGL();

    void DrawTriangle(float (&TablePoints)[9], float (&TableColors)[9]);
    void DrawRectangle(float (&TablePoints)[12], float (&TableColors)[12]);

    int XRot;
    int YRot;
    int ZRot;
    int XTrans;
    int YTrans;
    int ZTrans;

protected:

signals:
    
public slots:
    
private:
    GLuint m_posAttr;
    GLuint m_colAttr;
    GLuint m_matrixUniform;

    QOpenGLShaderProgram *m_program;
};

#endif // TESTWIDGET_H
#include "testwidget.h"

TestWidget::TestWidget(QWidget *parent) :
    QGLWidget(parent)
{
    XRot = 0;
    YRot = 0;
    ZRot = 0;
    XTrans = 0;
    YTrans = 0;
    ZTrans = -50;
}

QVector<QVector3D> vertices;
QVector<QVector3D> normals;


void TestWidget::initializeGL()
{
    const char *vertexShaderSource =
        "attribute highp vec4 posAttr;\n"
        "attribute lowp vec4 colAttr;\n"
        "varying lowp vec4 col;\n"
        "uniform highp mat4 matrix;\n"
        "void main() {\n"
        "   col = colAttr;\n"
        "   gl_Position = matrix * posAttr;\n"
        "}\n";

    const char *fragmentShaderSource =
        "varying lowp vec4 col;\n"
        "void main() {\n"
        "   gl_FragColor = col;\n"
        "}\n";

    m_program = new QOpenGLShaderProgram(this);
    m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
    m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
    m_program->link();
    m_posAttr = m_program->attributeLocation("posAttr");
    m_colAttr = m_program->attributeLocation("colAttr");
    m_matrixUniform = m_program->uniformLocation("matrix");
    glEnable(GL_DEPTH_TEST);
}

void TestWidget::resizeGL(int w, int h)
{
}

void TestWidget::paintGL()
{
    glViewport(0, 0, this->width(), this->height());
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    m_program->bind();
    QMatrix4x4 matrix;
    float WW = width();
    float HH = height();
    matrix.setToIdentity();
    matrix.perspective(60, WW / HH, 1.0, 100.0);
    matrix.translate(((float)XTrans) / 10.0, ((float)YTrans) / 10.0, ((float)ZTrans) / 10.0);
    matrix.rotate(XRot, 1, 0, 0);
    matrix.rotate(YRot, 0, 1, 0);
    matrix.rotate(ZRot, 0, 0, 1);
    m_program->setUniformValue(m_matrixUniform, matrix);


    float Points1[12] = {-1,  1, -1,   1,  1, -1,  -1, -1, -1,   1, -1, -1};
    float Points2[12] = {-1, -1,  1,   1, -1,  1,  -1, -1, -1,   1, -1, -1};
    float Points3[12] = {-1, -1,  1,  -1,  1,  1,  -1, -1, -1,  -1,  1, -1};

    float Points4[12] = {-1,  1,  1,   1,  1,  1,  -1, -1,  1,   1, -1,  1};
    float Points5[12] = {-1,  1,  1,   1,  1,  1,  -1,  1, -1,   1,  1, -1};
    float Points6[12] = { 1, -1,  1,   1,  1,  1,   1, -1, -1,   1,  1, -1};

    float Colors1[12] = {1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0};
    float Colors2[12] = {0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0};
    float Colors3[12] = {0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0};

    float Colors4[12] = {1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1};
    float Colors5[12] = {1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0};
    float Colors6[12] = {0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0};


    DrawRectangle(Points1, Colors1);
    DrawRectangle(Points2, Colors2);
    DrawRectangle(Points3, Colors3);
    DrawRectangle(Points4, Colors4);
    DrawRectangle(Points5, Colors5);
    DrawRectangle(Points6, Colors6);

    m_program->release();
}

void TestWidget::DrawTriangle(float (&TablePoints)[9], float (&TableColors)[9])
{
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(m_posAttr, 3, GL_FLOAT, GL_FALSE, 0, &TablePoints);
    glVertexAttribPointer(m_colAttr, 3, GL_FLOAT, GL_FALSE, 0, &TableColors);
    glDrawArrays(GL_TRIANGLES, 0, 3);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(0);
}

void TestWidget::DrawRectangle(float (&TablePoints)[12], float (&TableColors)[12])
{
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(m_posAttr, 3, GL_FLOAT, GL_FALSE, 0, &TablePoints);
    glVertexAttribPointer(m_colAttr, 3, GL_FLOAT, GL_FALSE, 0, &TableColors);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(0);
}

Mam przeczucie, że tu o jakiś drobiazg chodzi, bo w Windowsie to działa bez najmniejszych problemów.

0

W ramach własnych poszukiwań i prób zamieniłem treść procedury DrawRectangle na taka:

    QVector<QVector3D> V1;
    QVector<QVector3D> V2;
    V1 << QVector3D(TablePoints[0], TablePoints[1], TablePoints[2]);
    V1 << QVector3D(TablePoints[3], TablePoints[4], TablePoints[5]);
    V1 << QVector3D(TablePoints[6], TablePoints[7], TablePoints[8]);
    V1 << QVector3D(TablePoints[9], TablePoints[10], TablePoints[11]);

    V2 << QVector3D(TableColors[0], TableColors[1], TableColors[2]);
    V2 << QVector3D(TableColors[3], TableColors[4], TableColors[5]);
    V2 << QVector3D(TableColors[6], TableColors[7], TableColors[8]);
    V2 << QVector3D(TableColors[9], TableColors[10], TableColors[11]);

    m_program->enableAttributeArray(m_posAttr);
    m_program->enableAttributeArray(m_colAttr);
    m_program->setAttributeArray(m_posAttr, V1.constData());
    m_program->setAttributeArray(m_colAttr, V2.constData());
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    m_program->disableAttributeArray(m_posAttr);
    m_program->disableAttributeArray(m_colAttr);

Powyższy kod bez problemu działa w obu systemach, na pierwszy rzut oka jest strzałem w 10, ale, jak widać, zastosowany sposób jest okrężny, bo tablica jest konwertowana na wektor, a potem wektory na tablice.

Potem wymyśliłem takie coś:

    m_program->enableAttributeArray(m_posAttr);
    m_program->enableAttributeArray(m_colAttr);
    glVertexAttribPointer(m_posAttr, 3, GL_FLOAT, GL_FALSE, 0, &TablePoints);
    glVertexAttribPointer(m_colAttr, 3, GL_FLOAT, GL_FALSE, 0, &TableColors);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    m_program->disableAttributeArray(m_posAttr);
    m_program->disableAttributeArray(m_colAttr);

Powyższy kod na Windows działa, ale na Linux już nie, dając taki sam skutek, jak na początku.

0

Ostatecznie zarówno w Windows, jak i Linux program działa dobrze przy takiej procedurze:

void TestWidget::DrawRectangle(float (&TablePoints)[12], float (&TableColors)[12])
{
    m_program->enableAttributeArray(m_posAttr);
    m_program->enableAttributeArray(m_colAttr);
    m_program->setAttributeArray(m_posAttr, GL_FLOAT, &TablePoints, 3);
    m_program->setAttributeArray(m_colAttr, GL_FLOAT, &TableColors, 3);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    m_program->disableAttributeArray(m_posAttr);
    m_program->disableAttributeArray(m_colAttr);
}

Jednak zaraz po uruchomieniu jest taki log:

Uruchamianie /home/xxx/Pulpit/OpenGlTest/build-OpenGlTest-Desktop_Qt_5_0_2_GCC_32bit-Debug/OpenGlTest...
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
QBackingStore::flush() called with non-exposed window, behavior is undefined
/home/xxx/Pulpit/OpenGlTest/build-OpenGlTest-Desktop_Qt_5_0_2_GCC_32bit-Debug/OpenGlTest zakończone kodem 0

Podczas pracy nic się do logu nie dopisywało. Pod Windowsem w ogóle nie ma zadnych wpisów o błędach, ani ostrzeżeniach.

Ale jest mały progrem z innej beczki:
Podczas pracy tego programu, ale również przy wspomnianym programie "cube" jest taka sprawa, że nawet, jak okno programu jest schowane za innym oknem, to sam obraz 3D generowany przez OpenGL jest widoczny, jak się kliknie myszką, to zareaguje to okno, które jest bezpśrednio pod tym obrazem. Widać to doskonale na załączonym obrazku.

0

Jak osoby powyżej napisały - może być problem jeśli to ma działać pod OpenGL na wirtualnej maszynie. Może sprawdź jeszcze czy masz akcelerację na Linuksie włączoną:

glxinfo | grep rende

Warto by było sprawdzić czy program działa na normalnym Linuksie. Jakbyś udostępnił pełne źródła projektu testowego to mogę sprawdzić u siebie czy program się uruchamia.

0
Hostel napisał(a):

Warto by było sprawdzić czy program działa na normalnym Linuksie. Jakbyś udostępnił pełne źródła projektu testowego to mogę sprawdzić u siebie czy program się uruchamia.

W załączniku cały projekt

0

OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table

Nieistotne, to są rozszerzenia Nvidii (literki NV na końcu). Widocznie ich nie masz, albo VBox ich nie implementuje.

OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa0667e0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
OpenGL Warning: glXGetFBConfigAttrib for 0xa0667e0, failed to get XVisualInfo

A to wygląda groźnie, "0 visuals" sugeruje że GL się nie zainicjował...

Ale mówisz że działa?

Przyzwyczaj się, że programy linuksowe sieją mnóstwo śmieci do konsoli. Spróbuj odpalić takiego Firefoksa albo LibreOffice spod konsoli, dopiero zobaczysz ile "błędów" się dzieje o których nie masz pojęcia...

0

Aby zrobić glxinfo, musiałem zainstalować mesa-utils, potem glxinfo zwraca następujący wynik

xxx@xxx-VirtualBox:~$ glxinfo | grep render
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
direct rendering: Yes
OpenGL renderer string: Chromium
xxx@xxx-VirtualBox:~$
0

Czy próbowałeś skompilować i uruchomić hello worlda z OpenGL, który by nie korzystał w żaden sposób z Qt?

0
Azarien napisał(a):

Czy próbowałeś skompilować i uruchomić hello worlda z OpenGL, który by nie korzystał w żaden sposób z Qt?

Chciałem uruchomić ten przykład: http://www.cs.utah.edu/~jstratto/opengl/

Zainstalowałem GLUT tak, jak jest na tej stronie: http://www.kiwwito.com/article/installing-opengl-glut-libraries-in-ubuntu

Jak zainstalowałem "binutils-gold", to nadal program nie kompilował się, potem jak zainstalowałem "freeglut3 freeglut3-dev", to program skompilował się za pomocą make, ale przy próbie uruchomienia pokazał błąd ochrony pamieci, program nie uruchomił się.

xxx@xxx-VirtualBox:~/Pulpit/XXX$ make
g++ main.cpp -o part1 -lGL -lGLU -lglut
xxx@xxx-VirtualBox:~/Pulpit/XXX$ ./part1
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x8664698
OpenGL Warning: Retry with 0x8002 returned 0 visuals
Naruszenie ochrony pamięci (core dumped)
xxx@xxx-VirtualBox:~/Pulpit/XXX$

Będę musiał spróbować znaleźć jakiś przykład niewykorzystujący GLUT.

Potem próbowałem skompilować i uruchomić przykład z http://www.kiwwito.com/article/installing-opengl-glut-libraries-in-ubuntu:

W tym przypadku był ten sam problem z uruchomieniem

xxx@xxx-VirtualBox:~/Pulpit/XXX$ gcc -lGL -lglut test.c -o test
xxx@xxx-VirtualBox:~/Pulpit/XXX$ test
xxx@xxx-VirtualBox:~/Pulpit/XXX$ ./test
OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
OpenGL Warning: glVertexArrayRangeNV not found in mesa table
OpenGL Warning: glCombinerInputNV not found in mesa table
OpenGL Warning: glCombinerOutputNV not found in mesa table
OpenGL Warning: glCombinerParameterfNV not found in mesa table
OpenGL Warning: glCombinerParameterfvNV not found in mesa table
OpenGL Warning: glCombinerParameteriNV not found in mesa table
OpenGL Warning: glCombinerParameterivNV not found in mesa table
OpenGL Warning: glFinalCombinerInputNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
OpenGL Warning: glDeleteFencesNV not found in mesa table
OpenGL Warning: glFinishFenceNV not found in mesa table
OpenGL Warning: glGenFencesNV not found in mesa table
OpenGL Warning: glGetFenceivNV not found in mesa table
OpenGL Warning: glIsFenceNV not found in mesa table
OpenGL Warning: glSetFenceNV not found in mesa table
OpenGL Warning: glTestFenceNV not found in mesa table
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x81a6af0
OpenGL Warning: Retry with 0x8002 returned 0 visuals
Naruszenie ochrony pamięci (core dumped)
xxx@xxx-VirtualBox:~/Pulpit/XXX$ 
0

Odpal chociażby z LiveCD zamiast VMki.

1 użytkowników online, w tym zalogowanych: 0, gości: 1