| 154 | } |
| 155 | |
| 156 | GLuint getGLSLProgram(const char* programId, const char* vertexProg, const char* fragmentProg) |
| 157 | { |
| 158 | int context = getContext(); |
| 159 | ContextData& contextData = gContextDataMap[context]; |
| 160 | |
| 161 | std::map<const char*, GLuint>::iterator it = contextData.idGLSL.find(programId); |
| 162 | if (it == contextData.idGLSL.end()) |
| 163 | { |
| 164 | GLuint vertexShader = getGLSLVertexShader(vertexProg); |
| 165 | GLuint fragmentShader = getGLSLFragmentShader(fragmentProg); |
| 166 | GLuint shaderProgram = glCreateProgram(); |
| 167 | glAttachShader(shaderProgram, vertexShader); |
| 168 | glAttachShader(shaderProgram, fragmentShader); |
| 169 | glLinkProgram(shaderProgram); |
| 170 | glDeleteShader(vertexShader); |
| 171 | glDeleteShader(fragmentShader); |
| 172 | |
| 173 | it = contextData.idGLSL.insert(std::pair<const char*, GLuint>(programId, shaderProgram)).first; |
| 174 | } |
| 175 | |
| 176 | return it->second; |
| 177 | } |
| 178 | |
| 179 | void freeResources() |
| 180 | { |
no test coverage detected