MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / initColor

Method initColor

libs/CCFbo/src/ccFrameBufferObject.cpp:130–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130bool ccFrameBufferObject::initColor(GLint internalformat/*=GL_RGBA*/,
131 GLenum format/*=GL_RGBA*/,
132 GLenum type/*=GL_UNSIGNED_BYTE*/,
133 GLint minMagFilter/*=GL_NEAREST*/,
134 GLenum target/*=GL_TEXTURE_2D*/)
135{
136 if (!m_isValid || m_fboId == 0)
137 {
138 assert(false);
139 return false;
140 }
141
142 //create the new texture
143 m_glFunc.glPushAttrib(GL_ENABLE_BIT);
144 m_glFunc.glEnable(GL_TEXTURE_2D);
145
146 GLuint texID = 0;
147 m_glFunc.glGenTextures(1, &texID);
148 m_glFunc.glBindTexture(target, texID);
149 m_glFunc.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, minMagFilter);
150 m_glFunc.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minMagFilter);
151 m_glFunc.glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
152 m_glFunc.glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
153 m_glFunc.glTexImage2D(target, 0, internalformat, m_width, m_height, 0, format, type, nullptr);
154 m_glFunc.glBindTexture(target, 0);
155
156 m_glFunc.glPopAttrib();
157
158 if (attachColor(texID, true, target))
159 {
160 return true;
161 }
162 else
163 {
164 m_glFunc.glDeleteTextures(1, &texID);
165 return false;
166 }
167}
168
169bool ccFrameBufferObject::attachColor( GLuint texID,
170 bool ownTexture/*=false*/,

Callers 5

initMethod · 0.80
initFBOSafeMethod · 0.80
renderToImageMethod · 0.80
initMethod · 0.80
initMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected