opengles 系统变量不是被识别。
/ 创建深度纹理并将其连接到帧缓冲区对象
int Shadows::initShadowMap() {
GLenum none = GL_NONE;
GLint defaultFramebuffer = 0;
// use 1K by 1K texture for shadow map
shadowMapTextureWidth = shadowMapTextureHeight = 1024;
glGenTextures(1, &shadowMapTextureId);
glBindTexture(GL_TEXTURE_2D, shadowMapTextureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// Setup hardware comparison
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24,
shadowMapTextureWidth, shadowMapTextureHeight,
0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);
glBindTexture(GL_TEXTURE_2D, 0);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFramebuffer);
// setup fbo
glGenFramebuffers(1, &shadowMapBufferId);
glBindFramebuffer(GL_FRAMEBUFFER, shadowMapBufferId);
glDrawBuffers(1, &none);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_TEXTURE_2D, shadowMapTextureId,0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, shadowMapTextureId);
if (GL_FRAMEBUFFER_COMPLETE != glCheckFramebufferStatus(GL_FRAMEBUFFER)) {
return GL_FALSE;
}
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
return GL_TRUE;
}
是我需要引入其他得库么?为什么 error: use of undeclared identifier 'GL_TEXTURE_COMPARE_MODE' 会提示这样得报错
没包含头文件吧,GL相关的都报错啊
http://t.zoukankan.com/gdutbean-p-1983739.html
这有一堆头文件,看看少加了哪个