void RenderInterfaceDefaultGLCore::linkProgram(GLuint * program) { glLinkProgram(*program); checkGLError(__FILE__, __LINE__); GLint status = GL_FALSE; glGetProgramiv(*program, GL_LINK_STATUS, &status); if (status == GL_FALSE) { GLint infoLogLength = 0; glGetProgramiv(*program, GL_INFO_LOG_LENGTH, &infoLogLength); if (infoLogLength > 0) { char strInfoLog[1024] = {'\0'}; glGetProgramInfoLog(*program, sizeof(strInfoLog), nullptr, strInfoLog); errorF("NTB RenderInterfaceDefaultGLCore: Shader program linking failure:\n%s", strInfoLog); } else { errorF("NTB RenderInterfaceDefaultGLCore: Shader program linking failure - unknown error."); } glDeleteProgram(*program); (*program) = 0; } }
void RenderInterfaceDefaultGLCore::compileShader(GLuint * shader) { glCompileShader(*shader); checkGLError(__FILE__, __LINE__); GLint status = GL_FALSE; glGetShaderiv(*shader, GL_COMPILE_STATUS, &status); if (status == GL_FALSE) { GLint infoLogLength = 0; glGetShaderiv(*shader, GL_INFO_LOG_LENGTH, &infoLogLength); if (infoLogLength > 0) { char strInfoLog[1024] = {'\0'}; glGetShaderInfoLog(*shader, sizeof(strInfoLog), nullptr, strInfoLog); errorF("NTB RenderInterfaceDefaultGLCore: Shader compilation failure:\n%s", strInfoLog); } else { errorF("NTB RenderInterfaceDefaultGLCore: Shader compilation failure - unknown error."); } glDeleteShader(*shader); (*shader) = 0; } }
void enterT(char *id) /* It records a name id in the name table. */ { if (tIndex++ < MAXTABLE){ strcpy(nameTable[tIndex].name, id); } else errorF("too many names"); }
/* 名前表に名前を登録 */ void enterT(char *id) { if (tIndex++ < MAXTABLE) strcpy(nameTable[tIndex].name, id); else errorF("too many names"); }
void RenderInterfaceDefaultGLCore::destroyTexture(TextureHandle texture) { if (texture == nullptr) { return; } GLTextureRecord * found = nullptr; GLTextureRecord * iter = textures.getFirst(); for (int count = textures.getSize(); count--; iter = iter->next) { if (iter == reinterpret_cast<const GLTextureRecord *>(texture)) { found = iter; break; } } if (!found) { errorF("GL texture handle %p not allocated from this RenderInterface!", reinterpret_cast<const void *>(texture)); return; } glDeleteTextures(1, &found->texId); textures.unlink(found); implFree(found); }
void RenderInterfaceDefaultGLCore::checkGLError(const char * const file, const int line) { GLenum err = 0; while ((err = glGetError()) != 0) { errorF("%s(%d) : GL_ERROR=0x%X - %s", file, line, err, errorToString(err)); } }
void blockBegin(int firstAddr) /* It is called when a block starts. */ { if (level == -1){ /* It initializes variables if it is the main block. */ localAddr = firstAddr; tIndex = 0; level++; return; } if (level == MAXLEVEL-1) errorF("too many nested blocks"); lastIndex[level] = tIndex; /* It preserves information of the previous block. */ addr[level] = localAddr; localAddr = firstAddr; /* The address of the first variable in the new block */ level++; /* The level of the new block */ return; }
/* ブロックの始まり(最初の変数の番地)で呼ばれる */ void blockBegin(int firstAddr) { if (level == -1) { /* 主ブロックの時、初期設定 */ localAddr = firstAddr; tIndex = 0; level++; return; } if (level == MAXLEVEL-1) errorF("too many nested blocks"); index[level] = tIndex; /* 今までのブロックの情報を格納 */ addr[level] = localAddr; localAddr = firstAddr; /* 新しいブロックの最初の変数の番地 */ level++; /* 新しいブロックのレベル */ return; }
void SettingHolder::showError(const string& aError) const noexcept { if (errorF) errorF(aError); }