Win32EGLSupport::Win32EGLSupport() { //RECT windowRect; //GetClientRect(mNativeDisplay, &windowRect); mNativeDisplay = getNativeDisplay(); mGLDisplay = getGLDisplay(); // Video mode possibilities DEVMODE DevMode; DevMode.dmSize = sizeof(DEVMODE); for (DWORD i = 0; EnumDisplaySettings(NULL, i, &DevMode); ++i) { if (DevMode.dmBitsPerPel < 16) continue; mCurrentMode.first.first = DevMode.dmPelsWidth; mCurrentMode.first.second = DevMode.dmPelsHeight; mCurrentMode.second = 0; mOriginalMode = mCurrentMode; mVideoModes.push_back(mCurrentMode); } EGLConfig *glConfigs; int config, nConfigs = 0; glConfigs = chooseGLConfig(NULL, &nConfigs); for (config = 0; config < nConfigs; config++) { int caveat, samples; getGLConfigAttrib(glConfigs[config], EGL_CONFIG_CAVEAT, &caveat); if (caveat != EGL_SLOW_CONFIG) { getGLConfigAttrib(glConfigs[config], EGL_SAMPLES, &samples); mSampleLevels.push_back(StringConverter::toString(samples)); } } free(glConfigs); removeDuplicates(mSampleLevels); }
X11EGLSupport::X11EGLSupport() { // A connection that might be shared with the application for GL rendering: mGLDisplay = getGLDisplay(); // A connection that is NOT shared to enable independent event processing: mNativeDisplay = getNativeDisplay(); int dummy = 0; // TODO: Probe video modes mCurrentMode.first.first = DisplayWidth(mNativeDisplay, DefaultScreen(mNativeDisplay)); mCurrentMode.first.second = DisplayHeight(mNativeDisplay, DefaultScreen(mNativeDisplay)); mCurrentMode.second = 0; mOriginalMode = mCurrentMode; mVideoModes.push_back(mCurrentMode); EGLConfig *glConfigs; int config, nConfigs = 0; glConfigs = chooseGLConfig(NULL, &nConfigs); for (config = 0; config < nConfigs; config++) { int caveat, samples; getGLConfigAttrib(glConfigs[config], EGL_CONFIG_CAVEAT, &caveat); if (caveat != EGL_SLOW_CONFIG) { getGLConfigAttrib(glConfigs[config], EGL_SAMPLES, &samples); mSampleLevels.push_back(StringConverter::toString(samples)); } } free(glConfigs); removeDuplicates(mSampleLevels); }
Win32EGLSupport::Win32EGLSupport() { //RECT windowRect; //GetClientRect(mNativeDisplay, &windowRect); mNativeDisplay = getNativeDisplay(); mGLDisplay = getGLDisplay(); mCurrentMode.first.first = 555; // todo mCurrentMode.first.second = 555; // todo mCurrentMode.second = 0; mOriginalMode = mCurrentMode; mVideoModes.push_back(mCurrentMode); EGLConfig *glConfigs; int config, nConfigs = 0; glConfigs = chooseGLConfig(NULL, &nConfigs); for (config = 0; config < nConfigs; config++) { int caveat, samples; getGLConfigAttrib(glConfigs[config], EGL_CONFIG_CAVEAT, &caveat); if (caveat != EGL_SLOW_CONFIG) { getGLConfigAttrib(glConfigs[config], EGL_SAMPLES, &samples); mSampleLevels.push_back(StringConverter::toString(samples)); } } free(glConfigs); removeDuplicates(mSampleLevels); }
X11EGLSupport::X11EGLSupport() { mNativeDisplay = getNativeDisplay(); mGLDisplay = getGLDisplay(); int dummy; if (XQueryExtension((Display*)mNativeDisplay, "RANDR", &dummy, &dummy, &dummy)) { XRRScreenConfiguration *screenConfig; mRandr = true; screenConfig = XRRGetScreenInfo((Display*)mNativeDisplay, DefaultRootWindow((Display*)mNativeDisplay)); if (screenConfig) { XRRScreenSize *screenSizes; int nSizes = 0; Rotation currentRotation; int currentSizeID = XRRConfigCurrentConfiguration(screenConfig, ¤tRotation); screenSizes = XRRConfigSizes(screenConfig, &nSizes); mCurrentMode.first.first = screenSizes[currentSizeID].width; mCurrentMode.first.second = screenSizes[currentSizeID].height; mCurrentMode.second = XRRConfigCurrentRate(screenConfig); mOriginalMode = mCurrentMode; for (int sizeID = 0; sizeID < nSizes; sizeID++) { short *rates; int nRates = 0; rates = XRRConfigRates(screenConfig, sizeID, &nRates); for (int rate = 0; rate < nRates; rate++) { VideoMode mode; mode.first.first = screenSizes[sizeID].width; mode.first.second = screenSizes[sizeID].height; mode.second = rates[rate]; mVideoModes.push_back(mode); } } XRRFreeScreenConfigInfo(screenConfig); } } else { mCurrentMode.first.first = DisplayWidth((Display*)mNativeDisplay, DefaultScreen(mNativeDisplay)); mCurrentMode.first.second = DisplayHeight((Display*)mNativeDisplay, DefaultScreen(mNativeDisplay)); mCurrentMode.second = 0; mOriginalMode = mCurrentMode; mVideoModes.push_back(mCurrentMode); } EGLConfig *glConfigs; int config, nConfigs = 0; glConfigs = chooseGLConfig(NULL, &nConfigs); for (config = 0; config < nConfigs; config++) { int caveat, samples; getGLConfigAttrib(glConfigs[config], EGL_CONFIG_CAVEAT, &caveat); if (caveat != EGL_SLOW_CONFIG) { getGLConfigAttrib(glConfigs[config], EGL_SAMPLES, &samples); mSampleLevels.push_back(StringConverter::toString(samples)); } } free(glConfigs); removeDuplicates(mSampleLevels); }