Qglwidget cannot draw image
-
I am testing qt + opengl es in embedded system with mali400.
First of all, I did testing mali sdk sample source in board for mali and opengl es, that is OK.
and, I did coding sample program same as below, that is draw triangle in qglwidget, pc linux is OK.
but, embedded system is not draw triangle, only black in qglwidget.thank....
I did cross compile qt-everywhere-opensource-src-4.8.4 with below configuration
./configure -v -opensource -confirm-license -release -embedded arm -prefix /project/qte-dfb -no-neon -no-mmx -static -little-endian -no-accessibility -shared -no-cups -no-stl -qt-libpng -qt-libjpeg -no-qvfb -no-dbus -qt-freetype -no-nis -no-qt3support -no-largefile -no-libmng -no-separate-debug-info -nomake examples -nomake docs -nomake tools -depths 16,18,24 -optimized-qmake -pch -qt-libjpeg -qt-zlib -no-libtiff -ptmalloc -no-webkit -no-script -no-scripttools -xplatform qws/linux-arm-g++ -qt-mouse-tslib -I/home/tslib-master/arm_tslib/include -L/home/tslib-master/arm_tslib/lib -opengl -I/home/work/qt/OpenGLES_QT/OpenGLES -L/home/mali_drv
//////////// source code /////////////////////////////
@
#include "glwidget.h"glwidget::glwidget(QWidget *parent) :
QGLWidget(parent)
{
}void glwidget::initializeGL() {
glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glShadeModel(GL_SMOOTH);
}
const GLfloat triangleVertices[] {
-1.0f, -0.5f, 0.0f,
1.0f, -0.5f, 0.0f,
0.0f, 0.5f, 0.0f
};void glwidget::resizeGL(int w, int h)
{
glViewport(0,0,640,300);
glClearColor(1.0f,1.0f,1.0f,1.0f);
}void glwidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //glColor3f(1.0f, 0.0f, 0.0f); glColor4f(0.0f,1.0f,0.0f,0.0f); glEnableClientState(GL_VERTEX_ARRAY); { glVertexPointer(3, GL_FLOAT, 0, triangleVertices); glDrawArrays(GL_TRIANGLE_FAN, 0, 3); } glDisableClientState(GL_VERTEX_ARRAY);
}
@@
[edit, code wrappings introduced, koahnig] -
Please check out the "code wrapping handling":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01
This makes your code easier to read in the forum.