本文整理汇总了C++中Program::enableAttributeArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Program::enableAttributeArray方法的具体用法?C++ Program::enableAttributeArray怎么用?C++ Program::enableAttributeArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program::enableAttributeArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDLLoop
MyCaveGeneratorTestLoop(Window *w) : SDLLoop(w)
{
cout << "Initializing glew\n";
glewInit();
cout << "Binding program\n";
program.addShader(Shader(GL_VERTEX_SHADER, "functional/phong/shader.vp"));
program.addShader(Shader(GL_FRAGMENT_SHADER, "functional/phong/shader.fp"));
program.link();
program.bind();
cout << "Getting locations of shader parameters\n";
vertexLocation = program.getAttributeLocation("vPosition");
texCoordLocation = program.getAttributeLocation("uv");
vertexColorLocation = program.getAttributeLocation("vColor");
samplerLocation = program.getUniformLocation("image");
modelLocation = program.getUniformLocation("model");
perspectiveLocation= program.getUniformLocation("perspective");
normalLocation = program.getAttributeLocation("Normal");
ambientProductLocation = program.getUniformLocation("ambientProduct");
diffuseProductLocation = program.getUniformLocation("diffuseProduct");
specularProductLocation = program.getUniformLocation("specularProduct");
lightPositionLocation = program.getUniformLocation("LightPosition");
shininessLocation = program.getUniformLocation("shininess");
program.enableAttributeArray(vertexLocation);
program.enableAttributeArray(texCoordLocation);
program.enableAttributeArray(vertexColorLocation);
program.enableAttributeArray(normalLocation);
signal = new PerlinSignal;
signal->addFrequency(2, 0.2);
signal->addFrequency(16, 0.01);
}
示例2: SDLLoop
MyArray3DLayeredHeightfieldTestLoop(Window *w) : SDLLoop(w)
{
cout << "Initializing glew\n";
glewInit();
cout << "Binding program\n";
program.addShader(Shader(GL_VERTEX_SHADER, "functional/phong/shader.vp"));
program.addShader(Shader(GL_FRAGMENT_SHADER, "functional/phong/shader.fp"));
program.link();
program.bind();
cout << "Getting locations of shader parameters\n";
vertexLocation = program.getAttributeLocation("vPosition");
texCoordLocation = program.getAttributeLocation("uv");
vertexColorLocation = program.getAttributeLocation("vColor");
samplerLocation = program.getUniformLocation("image");
modelLocation = program.getUniformLocation("model");
perspectiveLocation= program.getUniformLocation("perspective");
normalLocation = program.getAttributeLocation("Normal");
ambientProductLocation = program.getUniformLocation("ambientProduct");
diffuseProductLocation = program.getUniformLocation("diffuseProduct");
specularProductLocation = program.getUniformLocation("specularProduct");
lightPositionLocation = program.getUniformLocation("LightPosition");
shininessLocation = program.getUniformLocation("shininess");
program.enableAttributeArray(vertexLocation);
program.enableAttributeArray(texCoordLocation);
program.enableAttributeArray(vertexColorLocation);
program.enableAttributeArray(normalLocation);
signal = new PerlinSignal;
signal->addFrequency(2, 0.5);
signal->addFrequency(16, 0.01);
generator = new MyLayeredVoxeledHeightfield(signal);
voxels = new Array3D<bool>(128, 128, 128);
generator->populateArray(voxels, 128);
for (int j = 0; j<5; j++) make_hole(*voxels);
for (int i =0; i<10; i++) (*voxels).copy(erode(*voxels));
adapter = new Array3DLayeredHeightfieldAdapter(*voxels);
adapter->generate();
h = adapter->getField();
cout << "Number of levels " << h->levelCount() << endl;
}
示例3: SDLLoop
MyVoxeledTerrainTestLoop(Window *w) : SDLLoop(w)
{
cout << "Initializing glew\n";
glewInit();
cout << "Binding program\n";
program.addShader(Shader(GL_VERTEX_SHADER, "functional/scene/shader.vp"));
program.addShader(Shader(GL_FRAGMENT_SHADER, "functional/scene/shader.fp"));
program.link();
program.bind();
cout << "Getting locations of shader parameters\n";
vertexLocation = program.getAttributeLocation("vPosition");
texCoordLocation = program.getAttributeLocation("uv");
vertexColorLocation = program.getAttributeLocation("vColor");
samplerLocation = program.getUniformLocation("image");
modelLocation = program.getUniformLocation("model");
perspectiveLocation= program.getUniformLocation("perspective");
normalLocation = program.getAttributeLocation("Normal");
ambientProductLocation = program.getUniformLocation("ambientProduct");
diffuseProductLocation = program.getUniformLocation("diffuseProduct");
specularProductLocation = program.getUniformLocation("specularProduct");
lightPositionLocation = program.getUniformLocation("LightPosition");
shininessLocation = program.getUniformLocation("shininess");
cout << program.getAttributeLocation("vPosition")<< endl;
cout << program.getAttributeLocation("uv")<< endl;
cout << program.getAttributeLocation("vColor")<< endl;
cout << program.getUniformLocation("image")<< endl;
cout << program.getUniformLocation("model")<< endl;
cout << program.getUniformLocation("perspective")<< endl;
cout << program.getAttributeLocation("Normal")<< endl;
cout << program.getUniformLocation("ambientProduct")<< endl;
cout << program.getUniformLocation("diffuseProduct")<< endl;
cout << program.getUniformLocation("specularProduct")<< endl;
cout << program.getUniformLocation("LightPosition")<< endl;
cout << program.getUniformLocation("shininess")<< endl;
cout << "Normal location: " << normalLocation << endl;
program.enableAttributeArray(vertexLocation);
program.enableAttributeArray(texCoordLocation);
program.enableAttributeArray(vertexColorLocation);
program.enableAttributeArray(normalLocation);
}