MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / initialize

Method initialize

Common/rendercheck_gl.h:797–856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795 }
796
797 bool initialize(unsigned width, unsigned height, fboConfig &rConfigFBO,
798 fboData &rActiveFBO) {
799 // Framebuffer config options
800 vector<bufferConfig> colorConfigs;
801 vector<bufferConfig> depthConfigs;
802 bufferConfig temp;
803
804 // add default color configs
805 temp.name = (m_bUseFloat ? "RGBA32F" : "RGBA8");
806 temp.bits = (m_bUseFloat ? 32 : 8);
807 temp.format = (m_bUseFloat ? GL_RGBA32F_ARB : GL_RGBA8);
808 colorConfigs.push_back(temp);
809
810 // add default depth configs
811 temp.name = "D24";
812 temp.bits = 24;
813 temp.format = GL_DEPTH_COMPONENT24;
814 depthConfigs.push_back(temp);
815
816 // If the FBO can be created, add it to the list of available configs, and
817 // make a menu entry
818 string root = colorConfigs[0].name + " " + depthConfigs[0].name;
819
820 rConfigFBO.colorFormat = colorConfigs[0].format;
821 rConfigFBO.depthFormat = depthConfigs[0].format;
822 rConfigFBO.redbits = colorConfigs[0].bits;
823 rConfigFBO.depthBits = depthConfigs[0].bits;
824
825 // single sample
826 rConfigFBO.name = root;
827 rConfigFBO.coverageSamples = 0;
828 rConfigFBO.depthSamples = 0;
829
830 create(width, height, rConfigFBO, rActiveFBO);
831
832 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
833
834 if (m_bUseFloat) {
835 // load fragment programs
836 const char *strTextureProgram2D =
837 "!!ARBfp1.0\n"
838 "TEX result.color, fragment.texcoord[0], texture[0], 2D;\n"
839 "END\n";
840
841 m_textureProgram =
842 nv::CompileASMShader(GL_FRAGMENT_PROGRAM_ARB, strTextureProgram2D);
843
844 const char *strOverlayProgram =
845 "!!ARBfp1.0\n"
846 "TEMP t;\n"
847 "TEX t, fragment.texcoord[0], texture[0], 2D;\n"
848 "MOV result.color, t;\n"
849 "END\n";
850
851 m_overlayProgram =
852 nv::CompileASMShader(GL_FRAGMENT_PROGRAM_ARB, strOverlayProgram);
853 }
854

Callers

nothing calls this directly

Calls 1

CompileASMShaderFunction · 0.85

Tested by

no test coverage detected