MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / InitGL

Method InitGL

engine/PoseidonGL33/EngineGL33_Lifecycle.cpp:1017–1052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015void EngineGL33::ClearLights() {}
1016
1017void EngineGL33::InitGL()
1018{
1019 LOG_INFO(Graphics, "GL33: InitGL — initializing shaders");
1020 if (!_glContext)
1021 return;
1022
1023 _frameOpen = false;
1024
1025 // Initialize queue storage
1026 static StaticStorage<WORD> TriangleQueueStorageNo[MaxTriQueues];
1027 for (int i = 0; i < MaxTriQueues; i++)
1028 {
1029 TriQueue& triqNo = _queueNo._tri[i];
1030 triqNo._triangleQueue.SetStorage(TriangleQueueStorageNo[i].Init(TriQueueSize));
1031 }
1032
1033 // 1x1 opaque-white sentinel for untextured P3D faces — see EngineGL33.hpp
1034 // for the full rationale. Created FIRST (before any other GL setup)
1035 // and pre-bound to unit 0, so any draw triggered before the first
1036 // SetTexture (early splash/progress paths) samples a defined texture
1037 // instead of GL name 0.
1038 glGenTextures(1, &_fallbackWhiteTex);
1039 GL33Bind::Tex2D(kUploadUnit - GL_TEXTURE0, _fallbackWhiteTex);
1040 const uint32_t whitePixel = 0xFFFFFFFFu;
1041 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &whitePixel);
1042 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1043 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1044 GL33Bind::Tex2D(0, _fallbackWhiteTex);
1045 GL33Bind::Tex2D(1, _fallbackWhiteTex);
1046 GL33Bind::ActiveUnit(0);
1047
1048 CreateVB();
1049 CreateVBTL();
1050 CreateTextBank();
1051 Init3DState();
1052}
1053
1054void EngineGL33::ShutdownGL()
1055{

Callers

nothing calls this directly

Calls 4

Tex2DFunction · 0.85
ActiveUnitFunction · 0.85
SetStorageMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected