Renderer* Init(Settings vs) { assert(!initted); if (initted) return 0; // no mode set, find an ok one if ((vs.width <= 0) || (vs.height <= 0)) { const std::vector<VideoMode> modes = GetAvailableVideoModes(); assert(!modes.empty()); vs.width = modes.front().width; vs.height = modes.front().height; } WindowSDL *window = new WindowSDL(vs, "Pioneer"); width = window->GetWidth(); height = window->GetHeight(); const int didLoad = ogl_LoadFunctions(); if (!didLoad) Error("glLoadGen failed to load functions.\n"); { std::ostringstream buf; write_opengl_info(buf); FILE *f = FileSystem::userFiles.OpenWriteStream("opengl.txt", FileSystem::FileSourceFS::WRITE_TEXT); if (!f) Output("Could not open 'opengl.txt'\n"); const std::string &s = buf.str(); fwrite(s.c_str(), 1, s.size(), f); fclose(f); } if (ogl_ext_EXT_texture_compression_s3tc == ogl_LOAD_FAILED) { Error("OpenGL extension GL_EXT_texture_compression_s3tc not supported.\nPioneer can not run on your graphics card as it does not support compressed (DXTn/S3TC) format textures."); } // We deliberately ignore the value from GL_NUM_COMPRESSED_TEXTURE_FORMATS, because some drivers // choose not to list any formats (despite supporting texture compression). See issue #3132. // This is (probably) allowed by the spec, which states that only formats which are "suitable // for general-purpose usage" should be enumerated. Renderer *renderer = new RendererOGL(window, vs); Output("Initialized %s\n", renderer->GetName()); std::ostringstream dummy; dump_and_clear_opengl_errors(dummy); initted = true; MaterialDescriptor desc; desc.effect = EFFECT_VTXCOLOR; desc.vertexColors = true; vtxColorMaterial = renderer->CreateMaterial(desc); vtxColorMaterial->IncRefCount(); return renderer; }
Renderer* Init(Settings vs) { assert(!initted); if (initted) return 0; // no mode set, find an ok one if ((vs.width <= 0) || (vs.height <= 0)) { const std::vector<VideoMode> modes = GetAvailableVideoModes(); assert(!modes.empty()); vs.width = modes.front().width; vs.height = modes.front().height; } // We deliberately ignore the value from GL_NUM_COMPRESSED_TEXTURE_FORMATS, because some drivers // choose not to list any formats (despite supporting texture compression). See issue #3132. // This is (probably) allowed by the spec, which states that only formats which are "suitable // for general-purpose usage" should be enumerated. assert(vs.rendererType < MAX_RENDERER_TYPE); assert(rendererCreateFunc[vs.rendererType]); Renderer *renderer = rendererCreateFunc[vs.rendererType](vs); if(renderer==nullptr) { Error("Failed to set video mode: %s", SDL_GetError()); return nullptr; } if (vs.rendererType == Graphics::RENDERER_DUMMY) { width = vs.width; height = vs.height; } else { width = renderer->GetWindowWidth(); height = renderer->GetWindowHeight(); } Output("Initialized %s\n", renderer->GetName()); { std::ostringstream buf; renderer->WriteRendererInfo(buf); FILE *f = FileSystem::userFiles.OpenWriteStream("opengl.txt", FileSystem::FileSourceFS::WRITE_TEXT); if (!f) Output("Could not open 'opengl.txt'\n"); const std::string &s = buf.str(); fwrite(s.c_str(), 1, s.size(), f); fclose(f); } initted = true; MaterialDescriptor desc; desc.effect = EFFECT_VTXCOLOR; desc.vertexColors = true; vtxColorMaterial = renderer->CreateMaterial(desc); vtxColorMaterial->IncRefCount(); return renderer; }
Renderer* Init(Settings vs) { assert(!initted); if (initted) return 0; // no mode set, find an ok one if ((vs.width <= 0) || (vs.height <= 0)) { const std::vector<VideoMode> modes = GetAvailableVideoModes(); assert(!modes.empty()); vs.width = modes.front().width; vs.height = modes.front().height; } WindowSDL *window = new WindowSDL(vs, "Pioneer"); width = window->GetWidth(); height = window->GetHeight(); glewInit(); if (!glewIsSupported("GL_ARB_vertex_buffer_object")) OS::Error("OpenGL extension ARB_vertex_buffer_object not supported. Pioneer can not run on your graphics card."); Renderer *renderer = 0; shadersAvailable = glewIsSupported("GL_VERSION_2_0"); shadersEnabled = vs.shaders && shadersAvailable; if (shadersEnabled) renderer = new RendererGL2(window, vs); else renderer = new RendererLegacy(window, vs); printf("Initialized %s\n", renderer->GetName()); initted = true; MaterialDescriptor desc; desc.vertexColors = true; vtxColorMaterial = renderer->CreateMaterial(desc); vtxColorMaterial->IncRefCount(); return renderer; }
Renderer* Init(Settings vs) { assert(!initted); if (initted) return 0; // no mode set, find an ok one if ((vs.width <= 0) || (vs.height <= 0)) { const std::vector<VideoMode> modes = GetAvailableVideoModes(); assert(!modes.empty()); vs.width = modes.front().width; vs.height = modes.front().height; } const SDL_VideoInfo *info = SDL_GetVideoInfo(); //printf("SDL_GetVideoInfo says %d bpp\n", info->vfmt->BitsPerPixel); switch (info->vfmt->BitsPerPixel) { case 16: SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); break; case 24: case 32: SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); break; default: fprintf(stderr, "Invalid pixel depth: %d bpp\n", info->vfmt->BitsPerPixel); } SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, vs.requestedSamples ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, vs.requestedSamples); SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, vs.vsync); Uint32 flags = SDL_OPENGL; if (vs.fullscreen) flags |= SDL_FULLSCREEN; // attempt sequence is: // 1- requested mode SDL_Surface *scrSurface = SDL_SetVideoMode(vs.width, vs.height, info->vfmt->BitsPerPixel, flags); // 2- requested mode with no anti-aliasing (skipped if no AA was requested anyway) if (!scrSurface && vs.requestedSamples) { fprintf(stderr, "Failed to set video mode. (%s). Re-trying without multisampling.\n", SDL_GetError()); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); scrSurface = SDL_SetVideoMode(vs.width, vs.height, info->vfmt->BitsPerPixel, flags); } // 3- requested mode with 16 bit depth buffer if (!scrSurface) { fprintf(stderr, "Failed to set video mode. (%s). Re-trying with 16-bit depth buffer\n", SDL_GetError()); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, vs.requestedSamples ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, vs.requestedSamples); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); scrSurface = SDL_SetVideoMode(vs.width, vs.height, info->vfmt->BitsPerPixel, flags); } // 4- requested mode with 16-bit depth buffer and no anti-aliasing // (skipped if no AA was requested anyway) if (!scrSurface && vs.requestedSamples) { fprintf(stderr, "Failed to set video mode. (%s). Re-trying with 16-bit depth buffer and no multisampling\n", SDL_GetError()); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); scrSurface = SDL_SetVideoMode(vs.width, vs.height, info->vfmt->BitsPerPixel, flags); } // 5- abort! if (!scrSurface) { OS::Error("Failed to set video mode: %s", SDL_GetError()); } // this valuable is not reliable if antialiasing settings are overridden by // nvidia/ati/whatever settings int actualSamples = 0; SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &actualSamples); if (vs.requestedSamples != actualSamples) fprintf(stderr, "Requested AA mode: %dx, actual: %dx\n", vs.requestedSamples, actualSamples); glewInit(); if (!glewIsSupported("GL_ARB_vertex_buffer_object")) OS::Error("OpenGL extension ARB_vertex_buffer_object not supported. Pioneer can not run on your graphics card."); Renderer *renderer = 0; shadersAvailable = glewIsSupported("GL_VERSION_2_0"); shadersEnabled = vs.shaders && shadersAvailable; if (shadersEnabled) renderer = new RendererGL2(vs); else renderer = new RendererLegacy(vs); printf("Initialized %s\n", renderer->GetName()); initted = true; MaterialDescriptor desc; desc.vertexColors = true; vtxColorMaterial = renderer->CreateMaterial(desc); vtxColorMaterial->IncRefCount(); Graphics::settings = vs; return renderer; }
//============================================================ // switchres_modeline_setup // //============================================================ bool switchres_modeline_setup(running_machine &machine) { ModeLine *bestMode; char modeline[1024]= {'\x00'}; bool success = false; int got_res = 0; mame_printf_verbose("SwitchRes: Entering switchres_modeline_setup (%d)\n", machine.switchRes.resolution.count); bestMode = &machine.switchRes.bestMode; windows_options &options = downcast<windows_options &>(machine.options()); astring error_string; if (!machine.switchRes.resolution.count) { strcpy(machine.switchRes.gameInfo.resolution, options.resolution()); machine.switchRes.cs.monitorcount = options.numscreens(); machine.switchRes.cs.doublescan = 0; if (!strcmp(options.video(), "d3d")) { machine.switchRes.cs.cleanstretch = 1; options.set_value(OPTION_CLEANSTRETCH, true, OPTION_PRIORITY_MAXIMUM, error_string); mame_printf_verbose("SwitchRes: Setting Option -cleanstretch\n"); } } // Save old modeline first if it exists if (machine.switchRes.resolution.count > 0) { memcpy(&machine.switchRes.lastMode, bestMode, sizeof(ModeLine)); mame_printf_verbose("SwitchRes: Copy lastMode name %s\n", machine.switchRes.lastMode.name); } // Generate modeline switchres_calc_modeline(machine); if (!machine.switchRes.modeLine) { mame_printf_error("SwitchRes: Modeline was NULL!!!\n"); return false; } // Initially get the registry modelines if (machine.switchRes.modecount == 0) { int custom_count = 0; machine.switchRes.modecount = GetAvailableVideoModes(machine.switchRes.videoModes); custom_count = GetCustomVideoModes(&machine.switchRes.cs, machine.switchRes.videoModes); mame_printf_verbose("SwitchRes: Found %d custom of %d active modelines\n", custom_count, machine.switchRes.modecount); } // If we got any, check for the best modeline if (machine.switchRes.modecount > 0) { int orientation = 0; if (machine.switchRes.gameInfo.orientation && !strcmp(machine.switchRes.cs.morientation, "horizontal")) orientation = 1; got_res = findBestMode(orientation, machine.switchRes.modeLine, machine.switchRes.videoModes, bestMode); mame_printf_verbose("SwitchRes: Index %d/%d modeline %s score %.02f %s\n", got_res, machine.switchRes.modecount, bestMode->label, bestMode->score, (got_res >= 0)?"matches":"has no match"); } else { got_res = -1; machine.switchRes.modecount = -1; mame_printf_error("SwitchRes: Didn't get any system or custom modelines %d\n", got_res); } // If we got a best mode, setup for use if (got_res != -1) { int use_ini = strcmp(machine.switchRes.gameInfo.resolution, "auto")?1:0; bool virtualize = false; // Got a registry modeline to change refresh rate of mame_printf_verbose("SwitchRes: Got %s modeline %s - %s:\n\t%s\n", bestMode->custom?"Custom":"System", bestMode->resolution, bestMode->label, PrintModeline(bestMode, modeline)); // Tweak modeline if height/width changed if (machine.switchRes.modeLine->hactive != bestMode->a_width || machine.switchRes.modeLine->vactive != bestMode->a_height) { int minwidth = machine.switchRes.modeLine->hactive; // Turn off .ini file support, since we can't do that use_ini = 0; // Use values from registry machine.switchRes.gameInfo.width = bestMode->a_width; machine.switchRes.gameInfo.height = bestMode->a_height; mame_printf_verbose("SwitchRes: Trying to recalculate modeline %d x %d != %d x %d\n", machine.switchRes.modeLine->hactive, machine.switchRes.modeLine->vactive, bestMode->a_width, bestMode->a_height); // Generate new modeline ModelineCreate(&machine.switchRes.cs, &machine.switchRes.gameInfo, machine.switchRes.monitorMode, machine.switchRes.modeLine); machine.switchRes.modeLine->weight = ModelineResult(machine.switchRes.modeLine, &machine.switchRes.cs); // Double check the height/width, recalculate if necessary if (machine.switchRes.modeLine->hactive != bestMode->a_width || machine.switchRes.modeLine->vactive != bestMode->a_height) { mame_printf_verbose("SwitchRes: Trying again to recalculate modeline %d x %d != %d x %d\n", machine.switchRes.modeLine->hactive, machine.switchRes.modeLine->vactive, bestMode->a_width, bestMode->a_height); if (machine.switchRes.modecount > 0) { int orientation = 0; int idx = 0; if (machine.switchRes.gameInfo.orientation && !strcmp(machine.switchRes.cs.morientation, "horizontal")) orientation = 1; idx = findBestMode(orientation, machine.switchRes.modeLine, machine.switchRes.videoModes, bestMode); mame_printf_verbose("SwitchRes: Recalculated index %d/%d modeline %s score %.02f %s\n", idx, machine.switchRes.modecount, bestMode->label, bestMode->score, (got_res >= 0)?"matches":"has no match"); if (idx) { if (bestMode->custom) { mame_printf_verbose("SwitchRes: Got %s modeline %s - %s:\n\t%s\n", bestMode->custom?"Custom":"System", bestMode->resolution, bestMode->label, PrintModeline(bestMode, modeline)); } else { mame_printf_verbose("SwitchRes: Got %s modeline %s\n", bestMode->custom?"Custom":"System", bestMode->label); } machine.switchRes.gameInfo.width = bestMode->a_width; machine.switchRes.gameInfo.height = bestMode->a_height; } else virtualize = true; } else virtualize = true; if (virtualize) mame_printf_error("SwitchRes: Failed at finding a good modeline!!!\n"); } // Check if aspect ratio needs to be fixed if (bestMode->a_width > minwidth) { mame_printf_verbose("SwitchRes: Setting Option -keepaspect\n"); options.set_value(WINOPTION_KEEPASPECT, true, OPTION_PRIORITY_MAXIMUM, error_string); } PrintModeline(machine.switchRes.modeLine, modeline); mame_printf_verbose("SwitchRes: New Modeline: \tModeLine %s\n", modeline); } // Set new resolution settings and reload it into the system if (!bestMode->custom || virtualize) { machine.switchRes.modeLine->result |= RESULT_VFREQ_CHANGE; success = true; } else if (!SetCustomVideoModes(&machine.switchRes.cs, bestMode, machine.switchRes.modeLine, 0)) { ResetVideoModes(); success = true; } else { machine.switchRes.modeLine->result |= RESULT_VIRTUALIZE; mame_printf_error("SwitchRes: Failed setting modeline!!!\n"); success = false; } // Calculate flags to set options CalculateMameOptions(machine); // If not virtualizing, do 1:1 scaling from original for height/width if (!(machine.switchRes.modeLine->result & RESULT_VIRTUALIZE)) { if ((machine.switchRes.modeLine->result & (RESULT_RES_INC|RESULT_RES_DEC))) virtualize = true; } else virtualize = true; if (virtualize) { // Adjust settings if stretched resolution mame_printf_verbose("SwitchRes: Setting Option -hwstretch\n"); options.set_value(WINOPTION_HWSTRETCH, true, OPTION_PRIORITY_MAXIMUM, error_string); mame_printf_verbose("SwitchRes: Setting Option -keepaspect\n"); options.set_value(WINOPTION_KEEPASPECT, true, OPTION_PRIORITY_MAXIMUM, error_string); // Aspect ratio specified if ((machine.switchRes.gameInfo.orientation && !strcmp(machine.switchRes.cs.morientation, "horizontal")) || (!machine.switchRes.gameInfo.orientation && !strcmp(machine.switchRes.cs.morientation, "vertical"))) { mame_printf_verbose("SwitchRes: Setting Option -screen_aspect %s\n", machine.switchRes.cs.aspect); options.set_value(WINOPTION_ASPECT, machine.switchRes.cs.aspect, OPTION_PRIORITY_MAXIMUM, error_string); } } // If interlacing, we need the filter on if (bestMode->interlace) { mame_printf_verbose("SwitchRes: Setting Option -filter\n"); options.set_value(WINOPTION_FILTER, true, OPTION_PRIORITY_MAXIMUM, error_string); } // Only use soundsync if set by user and also vsync doesn't match, else turn it off if (machine.switchRes.modeLine->result & RESULT_VFREQ_CHANGE) { if (machine.options().soundsync()) { mame_printf_verbose("SwitchRes: Setting Option -soundsync\n"); machine.switchRes.cs.soundsync = 1; } } else { mame_printf_verbose("SwitchRes: Setting Option -nosoundsync\n"); machine.switchRes.cs.soundsync = 0; } if ((machine.switchRes.modeLine->result & RESULT_VFREQ_CHANGE && !options.sync_refresh()) || options.triple_buffer()) { // Resolution doesn't match refresh rate mame_printf_verbose("SwitchRes: Disabling VSYNC\n"); mame_printf_verbose("SwitchRes: Setting Option -throttle\n"); options.set_value(OPTION_THROTTLE, true, OPTION_PRIORITY_MAXIMUM, error_string); mame_printf_verbose("SwitchRes: Setting Option -nowaitvsync\n"); options.set_value(WINOPTION_WAITVSYNC, false, OPTION_PRIORITY_MAXIMUM, error_string); } else { // Resolution matches refresh rate mame_printf_verbose("SwitchRes: Enabling VSYNC\n"); mame_printf_verbose("SwitchRes: Setting Option -nothrottle\n"); options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string); mame_printf_verbose("SwitchRes: Setting Option -waitvsync\n"); options.set_value(WINOPTION_WAITVSYNC, true, OPTION_PRIORITY_MAXIMUM, error_string); } // Force resolution if (!use_ini) { sprintf(machine.switchRes.bestMode.resolution, "%dx%d@%d", machine.switchRes.bestMode.hactive, machine.switchRes.bestMode.vactive, (int)machine.switchRes.bestMode.vfreq); mame_printf_verbose("SwitchRes: Setting Option -resolution %s\n", machine.switchRes.bestMode.resolution); options.set_value(WINOPTION_RESOLUTION, machine.switchRes.bestMode.resolution, OPTION_PRIORITY_MAXIMUM, error_string); // Setup video config resolution parameters screen 1 video_config.window[0].refresh = (int)machine.switchRes.bestMode.vfreq; video_config.window[0].width = machine.switchRes.bestMode.a_height; video_config.window[0].height = machine.switchRes.bestMode.a_width; } else mame_printf_verbose("SwitchRes: INI File resolution: %dx%d@%d\n", video_config.window[0].width, video_config.window[0].height, video_config.window[0].refresh); machine.switchRes.cs.cleanstretch = machine.options().cleanstretch(); machine.switchRes.resolution.count++; } else { mame_printf_error("SwitchRes: Couldn't find a working resolution for %dx%d@%d\n", machine.switchRes.modeLine->hactive, machine.switchRes.modeLine->vactive, (int)machine.switchRes.gameInfo.refresh); } return success; }
Renderer* Init(Settings vs) { assert(!initted); if (initted) return 0; // no mode set, find an ok one if ((vs.width <= 0) || (vs.height <= 0)) { const std::vector<VideoMode> modes = GetAvailableVideoModes(); assert(!modes.empty()); vs.width = modes.front().width; vs.height = modes.front().height; } WindowSDL *window = new WindowSDL(vs, "Pioneer"); width = window->GetWidth(); height = window->GetHeight(); GLenum glew_err; if ((glew_err = glewInit()) != GLEW_OK) Error("GLEW initialisation failed: %s", glewGetErrorString(glew_err)); { std::ostringstream buf; write_opengl_info(buf); FILE *f = FileSystem::userFiles.OpenWriteStream("opengl.txt", FileSystem::FileSourceFS::WRITE_TEXT); if (!f) Output("Could not open 'opengl.txt'\n"); const std::string &s = buf.str(); fwrite(s.c_str(), 1, s.size(), f); fclose(f); } if (!glewIsSupported("GL_VERSION_2_0") ) Error("OpenGL Version 2.0 is not supported. Pioneer cannot run on your graphics card."); if (!glewIsSupported("GL_ARB_vertex_buffer_object")) Error("OpenGL extension ARB_vertex_buffer_object not supported. Pioneer can not run on your graphics card."); if (!glewIsSupported("GL_EXT_texture_compression_s3tc")) Error("OpenGL extension GL_EXT_texture_compression_s3tc not supported.\nPioneer can not run on your graphics card as it does not support compressed (DXTn/S3TC) format textures."); // We deliberately ignore the value from GL_NUM_COMPRESSED_TEXTURE_FORMATS, because some drivers // choose not to list any formats (despite supporting texture compression). See issue #3132. // This is (probably) allowed by the spec, which states that only formats which are "suitable // for general-purpose usage" should be enumerated. Renderer *renderer = new RendererGL2(window, vs); Output("Initialized %s\n", renderer->GetName()); initted = true; MaterialDescriptor desc; desc.vertexColors = true; vtxColorMaterial = renderer->CreateMaterial(desc); vtxColorMaterial->IncRefCount(); return renderer; }
Renderer* Init(Settings vs) { assert(!initted); if (initted) return 0; // no mode set, find an ok one if ((vs.width <= 0) || (vs.height <= 0)) { const std::vector<VideoMode> modes = GetAvailableVideoModes(); assert(!modes.empty()); vs.width = modes.front().width; vs.height = modes.front().height; } WindowSDL *window = new WindowSDL(vs, "Pioneer"); width = window->GetWidth(); height = window->GetHeight(); glewExperimental = true; GLenum glew_err; if ((glew_err = glewInit()) != GLEW_OK) Error("GLEW initialisation failed: %s", glewGetErrorString(glew_err)); { std::ostringstream buf; write_opengl_info(buf); FILE *f = FileSystem::userFiles.OpenWriteStream("opengl.txt", FileSystem::FileSourceFS::WRITE_TEXT); if (!f) Output("Could not open 'opengl.txt'\n"); const std::string &s = buf.str(); fwrite(s.c_str(), 1, s.size(), f); fclose(f); } // pump this once as glewExperimental is necessary but spews a single error GLenum err = glGetError(); if (!glewIsSupported("GL_VERSION_3_2") ) Error("OpenGL Version 3.2 is not supported. Pioneer cannot run on your graphics card."); // Brilliantly under OpenGL 3.2 CORE profile Glew says this isn't supported, this forces us to use a COMPATIBILITY profile :/ if (!glewIsSupported("GL_EXT_texture_compression_s3tc")) { if (glewIsSupported("GL_ARB_texture_compression")) { GLint intv[4]; glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &intv[0]); if( intv[0] == 0 ) { Error("GL_NUM_COMPRESSED_TEXTURE_FORMATS is zero.\nPioneer can not run on your graphics card as it does not support compressed (DXTn/S3TC) format textures."); } } else { Error("OpenGL extension GL_EXT_texture_compression_s3tc not supported.\nPioneer can not run on your graphics card as it does not support compressed (DXTn/S3TC) format textures."); } } // We deliberately ignore the value from GL_NUM_COMPRESSED_TEXTURE_FORMATS, because some drivers // choose not to list any formats (despite supporting texture compression). See issue #3132. // This is (probably) allowed by the spec, which states that only formats which are "suitable // for general-purpose usage" should be enumerated. Renderer *renderer = new RendererOGL(window, vs); Output("Initialized %s\n", renderer->GetName()); std::ostringstream dummy; dump_and_clear_opengl_errors(dummy); initted = true; MaterialDescriptor desc; desc.effect = EFFECT_VTXCOLOR; desc.vertexColors = true; vtxColorMaterial = renderer->CreateMaterial(desc); vtxColorMaterial->IncRefCount(); return renderer; }