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

Function opengl_SetDefaults

renderer/HardwareOpenGL.cpp:327–390  ·  view source on GitHub ↗

Sets default states for our renderer

Source from the content-addressed store, hash-verified

325
326// Sets default states for our renderer
327void opengl_SetDefaults() {
328 mprintf(0, "Setting states\n");
329
330 gpu_state.cur_color = 0x00FFFFFF;
331 gpu_state.cur_bilinear_state = -1;
332 gpu_state.cur_zbuffer_state = -1;
333 gpu_state.cur_texture_quality = -1;
334 gpu_state.cur_light_state = LS_GOURAUD;
335 gpu_state.cur_color_model = CM_MONO;
336 gpu_state.cur_bilinear_state = -1;
337 gpu_state.cur_alpha_type = AT_TEXTURE;
338
339 // Enable some states
340 dglAlphaFunc(GL_GREATER, 0);
341 dglEnable(GL_ALPHA_TEST);
342 dglEnable(GL_BLEND);
343 dglEnable(GL_DITHER);
344 opengl_Blending_on = true;
345
346 rend_SetAlphaType(AT_ALWAYS);
347 rend_SetAlphaValue(255);
348 rend_SetFiltering(1);
349 rend_SetLightingState(LS_NONE);
350 rend_SetTextureType(TT_FLAT);
351 rend_SetColorModel(CM_RGB);
352 rend_SetZBufferState(1);
353 rend_SetZValues(0, 3000);
354 rend_SetGammaValue(gpu_preferred_state.gamma);
355 OpenGL_last_bound[0] = 9999999;
356 OpenGL_last_bound[1] = 9999999;
357 Last_texel_unit_set = -1;
358 OpenGL_multitexture_state = false;
359
360 dglEnableClientState(GL_VERTEX_ARRAY);
361 dglEnableClientState(GL_COLOR_ARRAY);
362 dglEnableClientState(GL_TEXTURE_COORD_ARRAY);
363
364 dglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
365 dglHint(GL_FOG_HINT, GL_NICEST);
366 dglEnable(GL_SCISSOR_TEST);
367 dglScissor(0, 0, gpu_state.screen_width, gpu_state.screen_height);
368 dglDisable(GL_SCISSOR_TEST);
369 dglDepthRange(0.0f, 1.0f);
370
371 if (UseMultitexture) {
372#if (defined(_USE_OGL_ACTIVE_TEXTURES))
373 oglActiveTextureARB(GL_TEXTURE0_ARB + 1);
374 oglClientActiveTextureARB(GL_TEXTURE0_ARB + 1);
375 dglEnableClientState(GL_TEXTURE_COORD_ARRAY);
376 dglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
377 dglHint(GL_FOG_HINT, GL_NICEST);
378
379 oglClientActiveTextureARB(GL_TEXTURE0_ARB + 0);
380
381 dglDisable(GL_TEXTURE_2D);
382 dglAlphaFunc(GL_GREATER, 0);
383 dglEnable(GL_ALPHA_TEST);
384 dglEnable(GL_BLEND);

Callers 2

opengl_InitFunction · 0.85
opengl_InitFunction · 0.85

Calls 9

rend_SetLightingStateFunction · 0.85
rend_SetAlphaTypeFunction · 0.70
rend_SetAlphaValueFunction · 0.70
rend_SetFilteringFunction · 0.70
rend_SetTextureTypeFunction · 0.70
rend_SetColorModelFunction · 0.70
rend_SetZBufferStateFunction · 0.70
rend_SetZValuesFunction · 0.70
rend_SetGammaValueFunction · 0.70

Tested by

no test coverage detected