我想在ubuntu 10.04中運行OpenGL示例。我勇敢地編譯了Qt代碼如下,並且非常棒。Qt的OpenGL示例抱怨一些錯誤,並且不會運行
./configure -prefix /home/user/Software/qt-4.7.4-openGL-without-opengl-graphics -xplatform linux-g++-32 -little-endian -opensource -debug-and-release -fast -exceptions -accessibility -stl -no-qt3support -xmlpatterns -multimedia -audio-backend -svg -webkit-debug -script -scripttools -declarative -qt-zlib -qt-libpng -qt-libjpeg -qt-libmng -qt-libtiff -make translations -make tools -make libs -opengl desktop -lglut
但後來滿意我從成功的編譯得到我試着運行的例子,有些不會運行。作爲開始,在打印以下內容之後,2dpainting示例將退出。
hijackWindow() context created for Window(0xbf8b0f2c) 1
QGLPixelBuffer: Unable to find a context/format match - giving up.
QGLWindowSurface: Failed to create valid pixelbuffer, falling back
QGLWindowSurface: Using plain widget as window surface QGLWindowSurface(0x8bf4990)
hijackWindow() context created for Widget(0x8be5ab0) 2
Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile
Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile
QGLShaderProgram: shader programs are not supported
The program has unexpectedly finished.
而且箱子的例子甚至沒有被編譯,出現以下錯誤。
qtbox.cpp: In member function 'virtual void QtBox::paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)':
qtbox.cpp:327: error: 'gluPerspective' was not declared in this scope
有人能告訴我我在做什麼錯嗎?
請問你的顯卡支持pbuffer而使?它是否支持着色器管道? gluPerspective是GLUT的一部分嗎? – cmannett85 2012-02-09 19:39:11
老實說,我不知道它是否是GLUT的一部分。我相信它應該是。因爲它是(至少它應該是)openGL Function.I有一個redeon HD 3450作爲我的視頻卡。不知道它是否支持你提到的那些。 – Tharanga 2012-02-10 07:20:05
我錯了,它不是GLUT,它是舊的OpenGL,這就是爲什麼我沒有看到它。您將不得不編寫一個測試程序來查詢Qt是否可以檢測到這些卡功能。在程序輸出的第二行,它暗示雖然創建了上下文,但它缺少QGLPixelBuffer所需的功能。因此,您必須查看源代碼,瞭解其請求的內容,並在創建上下文後通過'QGLContext :: format()'方法打印出其設法獲取的功能。 – cmannett85 2012-02-10 07:34:43