Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Brew Version. 3.1.5.
- OpenGL ES 1.1 extension.

I am using a sample code "Triangle Drawing".

when it calls eglCreateWindowSurface(), the return value is 0. maybe it means fail.

I don't know why it is failed.

help me. please.

boolean Renderer::Create(IShell * shell, IDisplay * display)
{
mDisplay = NULL;
mConfig = NULL;
mSurface = NULL;
mContext = NULL;

EGL_Init( shell );
GLES_Init( shell );

mDisplay = eglGetDisplay(display);

if (mDisplay == EGL_NO_DISPLAY )
{
Destroy();
return FALSE;

if (eglInitialize(mDisplay, NULL, NULL) == FALSE)
{
Destroy();
return FALSE;

EGLint numConfigs = 1;
if (eglGetConfigs(mDisplay, &mConfig, 1, &numConfigs) == FALSE)
{
Destroy();
return false;

IBitmap * DeviceBitmap = NULL;
IDIB * DIB = NULL;

if (IDISPLAY_GetDeviceBitmap(display, &DeviceBitmap) != SUCCESS)
{
Destroy();
return FALSE;

if (IBITMAP_QueryInterface(DeviceBitmap, AEECLSID_DIB, (void**)&DIB) != SUCCESS)
{
IBITMAP_Release(DeviceBitmap);
Destroy();
return FALSE;

EGLint params[5] = {EGL_NONE, EGL_NONE, EGL_NONE, EGL_NONE, EGL_NONE};
mSurface = eglCreateWindowSurface(mDisplay, mConfig, DIB, params); // here!!!!!!!!!!!

boolean Renderer::Create(IShell * shell, IDisplay * display)
{
mDisplay = NULL;
mConfig = NULL;
mSurface = NULL;
mContext = NULL;
EGLConfig myConfig;
EGL_Init( shell );
GLES_Init( shell );
EGLint ncfg = 1;
mDisplay = eglGetDisplay(display);
if (mDisplay == EGL_NO_DISPLAY )
{
Destroy();
return FALSE;

if (eglInitialize(mDisplay, NULL, NULL) == FALSE)
{
Destroy();
return FALSE;

if ( !eglGetConfigs(m_eglDisplay, NULL, 0, &ncfg) )
{
DBGPRINTF(" *** eglGetConfigs failed");
return EGL_FALSE;
}
EGLint attribList[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, -1,
EGL_DEPTH_SIZE, -1,
EGL_STENCIL_SIZE, -1,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
// Choose config
if ( !eglChooseConfig(m_eglDisplay, attribList, &myConfig, 1, &ncfg) )
{
DBGPRINTF(" *** eglChooseConfig failed");
return EGL_FALSE;
}
IBitmap * DeviceBitmap = NULL;
IDIB * DIB = NULL;
if (IDISPLAY_GetDeviceBitmap(display, &DeviceBitmap) != SUCCESS)
{
Destroy();
return FALSE;

if (IBITMAP_QueryInterface(DeviceBitmap, AEECLSID_DIB, (void**)&DIB) != SUCCESS)
{
IBITMAP_Release(DeviceBitmap);
Destroy();
return FALSE;

boolean Renderer::Create(IShell * shell, IDisplay * display)
{
mDisplay = NULL;
mConfig = NULL;
mSurface = NULL;
mContext = NULL;
EGLConfig myConfig;
EGL_Init( shell );
GLES_Init( shell );
EGLint ncfg = 1;
mDisplay = eglGetDisplay(display);
if (mDisplay == EGL_NO_DISPLAY )
{
Destroy();
return FALSE;

if (eglInitialize(mDisplay, NULL, NULL) == FALSE)
{
Destroy();
return FALSE;

if ( !eglGetConfigs(m_eglDisplay, NULL, 0, &ncfg) )
{
DBGPRINTF(" *** eglGetConfigs failed");
return EGL_FALSE;
}
EGLint attribList[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, -1,
EGL_DEPTH_SIZE, -1,
EGL_STENCIL_SIZE, -1,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
// Choose config
if ( !eglChooseConfig(m_eglDisplay, attribList, &myConfig, 1, &ncfg) )
{
DBGPRINTF(" *** eglChooseConfig failed");
return EGL_FALSE;
}
IBitmap * DeviceBitmap = NULL;
IDIB * DIB = NULL;
if (IDISPLAY_GetDeviceBitmap(display, &DeviceBitmap) != SUCCESS)
{
Destroy();
return FALSE;

if (IBITMAP_QueryInterface(DeviceBitmap, AEECLSID_DIB, (void**)&DIB) != SUCCESS)
{
IBITMAP_Release(DeviceBitmap);
Destroy();
return FALSE;