Hi
I create two POPUP the windows, one - fullscreen, the second - the smaller size. I try to initialize OpenGLES for the second window. As a result 3D it is deduced in a small window, but in fullscreen mode (all other black) in coordinate 0 0. Why?
void InitRenderingL(HWND aWindow)
{
const GLubyte *vendor;
const GLubyte *renderer;
const GLubyte *version;
const GLubyte *extensions;
EGLint majorVersion;
EGLint minorVersion;
EGLConfig config;
// Get the display for drawing graphics
iEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (iEglDisplay == NULL)
{
InitializedErrors(aWindow, L"eglGetDisplay failed:
", L"GLES Error");
}
// Initialize display
if (eglInitialize(iEglDisplay, &majorVersion, &minorVersion) == EGL_FALSE)
{
InitializedErrors(aWindow, L"eglInitialize failed:
", L"GLES Error");
}
EGLConfig *configList = NULL; // Pointer for EGLConfigs
EGLint numOfConfigs = 0;
EGLint configSize = 0;
// Get the number of possible EGLConfigs
if (eglGetConfigs(iEglDisplay, configList, configSize, &numOfConfigs) == EGL_FALSE)
InitializedErrors(aWindow, L"eglGetConfigs failed", L"GLES Error");
configSize = numOfConfigs;
// Allocate memory for the configList
configList = (EGLConfig*) malloc(sizeof(EGLConfig)*configSize);
if (configList == NULL)
{
InitializedErrors(aWindow, L"config alloc failed:
", L"GLES Error");
}
// Define properties for the wanted EGLSurface.
// To get the best possible performance, choose an EGLConfig with a buffersize matching
// the current window's display mode
DEVMODE dmode;
dmode.dmSize = sizeof(DEVMODE);
dmode.dmDriverExtra = 0;
TInt BufferSize = 0;
EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dmode);
BufferSize = dmode.dmBitsPerPel;
iDMode = dmode.dmBitsPerPel;
const EGLint configAttribs[] =
{
EGL_ALPHA_SIZE, 0,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
// Choose an EGLConfig that best matches to the properties in attrib_list
if (eglChooseConfig(iEglDisplay, configAttribs, configList, configSize, &numOfConfigs) == EGL_FALSE)
{
InitializedErrors(aWindow, L"eglChooseConfig failed:
", L"GLES Error");
}
if (numOfConfigs == 0)
{
InitializedErrors(aWindow, L"Can't find the requested config:
", L"GLES Error");
}
config = configList[0]; // Choose the best EGLConfig. EGLConfigs
// returned by eglChooseConfig are sorted so
// that the best matching EGLConfig is first in
// the list.
free(configList); // Free configList, not used anymore.
// Create a pixmap surface
iEglSurface = eglCreateWindowSurface(iEglDisplay, config, aWindow, NULL);
if (iEglSurface == NULL)
{
InitializedErrors(aWindow, L"eglCreateWindowSurface failed:
", L"GLES Error");
}
// Create a rendering context
iEglContext = eglCreateContext(iEglDisplay, config, EGL_NO_CONTEXT, NULL);
if (iEglContext == NULL)
{
InitializedErrors(aWindow, L"eglCreateContext failed:
", L"GLES Error");
}
// Make the context current. Binds context to the current rendering thread and surface.
if (eglMakeCurrent(iEglDisplay, iEglSurface, iEglSurface, iEglContext) == EGL_FALSE)
{
InitializedErrors(aWindow, L"eglMakeCurrent failed:
", L"GLES Error");
}
vendor = glGetString(GL_VENDOR);
renderer = glGetString(GL_RENDERER);
version = glGetString(GL_VERSION);
extensions = glGetString(GL_EXTENSIONS);
}