本文整理汇总了C++中KeyValue::release方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValue::release方法的具体用法?C++ KeyValue::release怎么用?C++ KeyValue::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValue
的用法示例。
在下文中一共展示了KeyValue::release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initDriver
//.........这里部分代码省略.........
const char *c_str = buffer.data;
GLuint vertexShader = glCreateShader( GL_VERTEX_SHADER );
glShaderSource( vertexShader, 1, &c_str, NULL );
glCompileShader( vertexShader );
shaders[name] = vertexShader;
GLint status;
glGetShaderiv( vertexShader, GL_COMPILE_STATUS, &status );
if (status == GL_TRUE) {
printf("Loaded vertex shader: %s (%d)\n", name, vertexShader);
} else {
char buffer[512];
glGetShaderInfoLog( vertexShader, 512, NULL, buffer );
printf("Error loading vertex shader: %s (%d)\n", name, vertexShader);
printf("%s\n", buffer);
}
}
delete file;
}
// Compile all the programs.
for (DirectoryList::iterator i = list.begin(); i != list.end(); ++i) {
char exten[10];
util->getFileExtension(exten, (*i).c_str());
if (strcmp(exten, ".kv") == 0) {
char name[50];
util->getFileName(name, (*i).c_str());
util->getFileNameNoExtension(name, name);
Buffer buffer;
File *file = filesystem->open((*i).c_str());
file->readBuffer(&buffer);
KeyValue *kv = util->parseKeyValue(&buffer);
GLuint shaderProgram = glCreateProgram();
KeyValue *shadermembers = kv->getMember("shaders");
if (shadermembers != NULL) {
unsigned int b = 0;
KeyValue *member = shadermembers->getMember(b);
while ((member = shadermembers->getMember(b)) != NULL) {
glAttachShader( shaderProgram, shaders[member->getString()] );
b++;
}
}
KeyValue *fragdatamembers = kv->getMember("fragdata");
if (fragdatamembers != NULL) {
unsigned int b = 0;
KeyValue *member = fragdatamembers->getMember(b);
while ((member = fragdatamembers->getMember(b)) != NULL) {
glBindFragDataLocation( shaderProgram, b, member->getString().c_str());
b++;
}
}
glLinkProgram( shaderProgram );
glUseProgram( shaderProgram );
GLint posAttrib = glGetAttribLocation( shaderProgram, "position" );
glEnableVertexAttribArray( posAttrib );
glVertexAttribPointer( posAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0 );
programs[name] = shaderProgram;
printf("Loaded program: %s (%d)\n", name, shaderProgram);
kv->release();
file->release();
}
}
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glBlendEquation( GL_FUNC_ADD );
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
loadMaterial("disttex.tga");
loadMaterial("8.tga");
// load default textures
ImageData white(1, 1);
white.setPixel(0, 0, Color(255, 255, 255));
loadMaterial("white", &white);
ImageData black(1, 1);
black.setPixel(0, 0, Color(0, 0, 0));
loadMaterial("black", &black);
glfwSetMouseButtonCallback(&MousePressedCallback);
}