MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / opengl_Init

Function opengl_Init

renderer/HardwareOpenGL.cpp:620–813  ·  view source on GitHub ↗

Sets up our OpenGL rendering context Returns 1 if ok, 0 if something bad

Source from the content-addressed store, hash-verified

618// Sets up our OpenGL rendering context
619// Returns 1 if ok, 0 if something bad
620int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) {
621 int width, height;
622 int retval = 1;
623 int i;
624
625 mprintf(0, "Setting up opengl mode!\n");
626
627 if (pref_state) {
628 gpu_preferred_state = *pref_state;
629 }
630
631 if (app != NULL) {
632 ParentApplication = app;
633 }
634
635 int windowX = 0, windowY = 0;
636
637 /***********************************************************
638 * LINUX OPENGL
639 ***********************************************************
640 */
641 // Setup gpu_state.screen_width & gpu_state.screen_height & width & height
642 width = gpu_preferred_state.width;
643 height = gpu_preferred_state.height;
644
645 if (!opengl_Setup(app, &width, &height)) {
646 opengl_Close();
647 return 0;
648 }
649
650 memset(&gpu_state, 0, sizeof(rendering_state));
651 gpu_state.screen_width = width;
652 gpu_state.screen_height = height;
653
654 // Get some info
655 opengl_GetInformation();
656
657 mprintf(0, "Setting up multitexture...\n");
658
659 // Determine if Multitexture is supported
660 bool supportsMultiTexture = opengl_CheckExtension("GL_ARB_multitexture");
661 if (!supportsMultiTexture) {
662 supportsMultiTexture = opengl_CheckExtension("GL_SGIS_multitexture");
663 }
664
665 if (FindArg("-NoMultitexture")) {
666 supportsMultiTexture = false;
667 }
668
669 if (supportsMultiTexture) {
670 // attempt to grab Multitexture functions
671 opengl_GetDLLFunctions();
672 } else {
673 // No multitexture at all
674 UseMultitexture = false;
675 }
676
677 // Do we have packed pixel formats?

Callers 3

rend_InitFunction · 0.70
rend_ReInitFunction · 0.70
rend_InitOpenGLWindowFunction · 0.70

Calls 9

opengl_SetDefaultsFunction · 0.85
g3_ForceTransformRefreshFunction · 0.85
opengl_SetupFunction · 0.70
opengl_CloseFunction · 0.70
opengl_GetInformationFunction · 0.70
opengl_CheckExtensionFunction · 0.70
opengl_GetDLLFunctionsFunction · 0.70
opengl_InitCacheFunction · 0.70
FindArgFunction · 0.50

Tested by

no test coverage detected