Hi…
I used OpenGL|ES in Qt-x11 virsion…
I made test code and run…but
X Error: GLXBadDrawable 158
Major opcode: 144
Minor opcode: 5
Resource id: 0x806aa90
How fixed that error?
OpenGL|ES init func is
static const EGLint configAttribs[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 5,
EGL_BLUE_SIZE, 5,
EGL_DEPTH_SIZE, 16,
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
EGLBoolean success;
EGLint numConfigs;
EGLint majorVersion;
EGLint minorVersion;
Display * display;
display = QPaintDevice::x11Display();
sEglDisplay = eglGetDisplay(display);
if(sEglDisplay==EGL_NO_DISPLAY)
qDebug(“EGL no display”);
else if(sEglDisplay==EGL_DEFAULT_DISPLAY)
qDebug(“EGL display”);
success = eglInitialize(sEglDisplay, &majorVersion, &minorVersion);
if (success != EGL_FALSE)
{
success = eglGetConfigs(sEglDisplay, NULL, 0, &numConfigs);
qDebug(“eglGetConfigs”);
}
if (success != EGL_FALSE)
{
success = eglChooseConfig(sEglDisplay, configAttribs,
&sEglConfig, 1, &numConfigs);
qDebug(“eglChooseconfig”);
}
if (success != EGL_FALSE)
{
sEglContext = eglCreateContext(sEglDisplay, sEglConfig, NULL, NULL);
if (sEglContext == EGL_NO_CONTEXT)
success = EGL_FALSE;
qDebug(“eglCreateContext”);
}
if (success != EGL_FALSE)
{
EGLint vid;
eglGetConfigAttrib(sEglDisplay, sEglConfig,
EGL_NATIVE_VISUAL_ID, &vid);
qDebug(“eglGetConfigAttrib”);
}
if (success != EGL_FALSE)
{
sEglSurface = eglCreateWindowSurface(sEglDisplay, sEglConfig,
this, NULL);
if (sEglSurface == EGL_NO_SURFACE)
success = EGL_FALSE;
qDebug(“eglCreateWidowSurface”);
}
if (success != EGL_FALSE)
success = eglMakeCurrent(sEglDisplay, sEglSurface,
sEglSurface, sEglContext);
qDebug(“eglMakeCurrent”);
if (success == EGL_FALSE)
// checkEGLErrors();
return success != EGL_FALSE;
/*Remember: because we are programming for a mobile device, we cant
use any of the OpenGL ES functions that finish in ‘f’, we must use
the fixed point version (they finish in ‘x’*/
glClearColorx(0, 0, 0, 0);
glShadeModel(GL_SMOOTH);
qDebug(“ww”);
/*In order to set a viewport that fits entirely our window, we need
to know the window dimensions. They could be obtained through the
WinCE call GetWindowRect, using our window handle*/
QRect r;
//GetWindowRect(hWnd, &r);
r = this->rect();
glViewport(r.left(), r.top(), r.right() - r.left(), r.bottom() - r.top());
/*Setup of the projection matrix. We will use an ortho cube centered
at (0,0,0) with 100 units of edge*/
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthox(FixedFromInt(-50), FixedFromInt(50), FixedFromInt(-50), FixedFromInt(50), FixedFromInt(-50), FixedFromInt(50));
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return TRUE;
}
How to fix that error??
help me…please…
Have a nice day…^^