MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / OnBeforeUserCreate

Method OnBeforeUserCreate

extensions/olcPGEX_Shaders.h:538–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536
537
538 void Shade::OnBeforeUserCreate()
539 {
540 // Load External OpenGL Functions
541 locCreateShader = OGL_LOAD(locCreateShader_t, glCreateShader);
542 locCompileShader = OGL_LOAD(locCompileShader_t, glCompileShader);
543 locShaderSource = OGL_LOAD(locShaderSource_t, glShaderSource);
544 locDeleteShader = OGL_LOAD(locDeleteShader_t, glDeleteShader);
545 locCreateProgram = OGL_LOAD(locCreateProgram_t, glCreateProgram);
546 locDeleteProgram = OGL_LOAD(locDeleteProgram_t, glDeleteProgram);
547 locLinkProgram = OGL_LOAD(locLinkProgram_t, glLinkProgram);
548 locAttachShader = OGL_LOAD(locAttachShader_t, glAttachShader);
549 locBindBuffer = OGL_LOAD(locBindBuffer_t, glBindBuffer);
550 locBufferData = OGL_LOAD(locBufferData_t, glBufferData);
551 locGenBuffers = OGL_LOAD(locGenBuffers_t, glGenBuffers);
552 locVertexAttribPointer = OGL_LOAD(locVertexAttribPointer_t, glVertexAttribPointer);
553 locEnableVertexAttribArray = OGL_LOAD(locEnableVertexAttribArray_t, glEnableVertexAttribArray);
554 locUseProgram = OGL_LOAD(locUseProgram_t, glUseProgram);
555 locGetShaderInfoLog = OGL_LOAD(locGetShaderInfoLog_t, glGetShaderInfoLog);
556
557
558 locGenFrameBuffers = OGL_LOAD(locGenFrameBuffers_t, glGenFramebuffers);
559 locBindFrameBuffer = OGL_LOAD(locBindFrameBuffer_t, glBindFramebuffer);
560 locCheckFrameBufferStatus = OGL_LOAD(locCheckFrameBufferStatus_t, glCheckFramebufferStatus);
561 locDeleteFrameBuffers = OGL_LOAD(locDeleteFrameBuffers_t, glDeleteFramebuffers);
562 locFrameBufferTexture2D = OGL_LOAD(locFrameBufferTexture2D_t, glFramebufferTexture2D);
563 locActiveTexture = OGL_LOAD(locActiveTexture_t, glActiveTexture);
564
565 locBlendFuncSeparate = OGL_LOAD(locBlendFuncSeparate_t, glBlendFuncSeparate);
566
567#if !defined(OLC_PLATFORM_EMSCRIPTEN)
568 locBindVertexArray = OGL_LOAD(locBindVertexArray_t, glBindVertexArray);
569 locGenVertexArrays = OGL_LOAD(locGenVertexArrays_t, glGenVertexArrays);
570 locDrawBuffers = OGL_LOAD(locDrawBuffers_t, glDrawBuffers);
571#else
572 locBindVertexArray = glBindVertexArrayOES;
573 locGenVertexArrays = glGenVertexArraysOES;
574 locDrawBuffers = glDrawBuffersNV;
575#endif
576
577
578
579 // Create a Frame Buffer Object that represents the
580 // offscreen rendering target gubbins
581 locGenFrameBuffers(1, (GLuint*)&m_nFBO);
582
583 // Create a Vertex object to represent polygons
584 locGenBuffers(1, &m_nVB);
585 locGenVertexArrays(1, &m_nVA);
586 locBindVertexArray(m_nVB);
587
588 locBindBuffer(0x8892, m_nVB);
589 sOmniVertex verts[OLC_MAX_VERTS];
590 locBufferData(0x8892, sizeof(sOmniVertex) * OLC_MAX_VERTS, verts, 0x88E0);
591
592 locVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(sOmniVertex), (void*)(0 * sizeof(float)));
593 locVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(sOmniVertex), (void*)(3 * sizeof(float)));
594 locVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(sOmniVertex), (void*)(4 * sizeof(float)));
595 locVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, sizeof(sOmniVertex), (void*)(6 * sizeof(float)));

Callers

nothing calls this directly

Calls 5

CreateMethod · 0.80
GetDataMethod · 0.80
DecalMethod · 0.80
SpriteMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected