//Called after the window and OpenGL are initialized. Called exactly once, before the main loop. void init() { InitializeProgram(); InitializeVertexData(); LoadTextures(); //Setup our Uniform Buffers glGenBuffers(1, &g_projectionUniformBuffer); glBindBuffer(GL_UNIFORM_BUFFER, g_projectionUniformBuffer); glBufferData(GL_UNIFORM_BUFFER, sizeof(ProjectionBlock), NULL, GL_DYNAMIC_DRAW); glBindBufferRange(GL_UNIFORM_BUFFER, g_projectionBlockIndex, g_projectionUniformBuffer, 0, sizeof(ProjectionBlock)); glBindBuffer(GL_UNIFORM_BUFFER, 0); }
VertexLoaderCompiled::VertexLoaderCompiled(const TVtxDesc &vtx_desc, const VAT &vtx_attr) : VertexLoaderBase(vtx_desc, vtx_attr) { VertexLoaderCompiled::Initialize(); VertexLoaderUID uid(vtx_desc, vtx_attr); PrecompiledVertexLoaderMap::iterator piter = s_PrecompiledVertexLoaderMap.find(uid.GetHash()); m_precompiledfunc = nullptr; if (piter != s_PrecompiledVertexLoaderMap.end()) { m_precompiledfunc = piter->second; m_initialized = true; InitializeVertexData(); } else { m_initialized = false; } }