本文整理汇总了C++中Pyramid::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Pyramid::draw方法的具体用法?C++ Pyramid::draw怎么用?C++ Pyramid::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyramid
的用法示例。
在下文中一共展示了Pyramid::draw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderObjects
void renderObjects()
{
// Set Modeling transformation for the reference plane
modelingTransformation = glm::translate(glm::vec3(0.0f, -3.0f, 0.0f));
refPlane.draw();
// Set modeling transformation for the front left pyramid
modelingTransformation = glm::translate(glm::vec3(-3.5f, -2.5f, 3.5f));
pyramid.draw(color(0.0f, 0.0f, 1.0f, 1.0f));
// Set modeling transformation for the back right pyramid
modelingTransformation = glm::translate(glm::vec3(3.5f, -2.5f, -3.5f));
pyramid.draw(color(0.0f, 0.0f, 1.0f, 1.0f));
// Set modeling transformation for the center pyramid
modelingTransformation = glm::translate(glm::vec3(0.0f, 0.0f, 0.0f)) * glm::rotate(angle, glm::vec3(0.0f, 1.0f, 0.0f));
pyramid.draw(color(1.0f, 0.0f, 0.0f, 1.0f));
// Set modeling transformation for the right hand pyramid
modelingTransformation = glm::translate(glm::vec3(3.0f, 0.0f, 0.0f)) * glm::rotate(angle, glm::vec3(1.0f, 0.0f, 0.0f));
sphere.draw(color(1.0f, 1.0f, 0.0f, 1.0f));
// Set modeling transformation for the left hand pyramid
modelingTransformation = glm::translate(glm::vec3(-3.0f, 0.0f, 0.0f)) * glm::rotate(angle, glm::vec3(0.0f, 0.0f, 1.0f)) * glm::scale(glm::vec3(2.0f, 2.0f, 2.0f));
pyramid.draw(color(1.0f, 0.0f, 1.0f, 1.0f));
}
示例2: RenderSceneCB
/**
* Acts as the display function for the window.
*/
static void RenderSceneCB()
{
vector<glm::vec4> transformedVertices;
// Clear the color buffer
colorBuffer.clearColorBuffer();
static float angle = glm::radians(45.0f);
angle += glm::radians(1.0f);
// Set Modeling transformation for the reference plane
modelingTransformation = glm::translate(glm::vec3(0.0f, -3.0f, 0.0f));
refPlane.draw();
// Set modeling transformation for the front left pyramid
modelingTransformation = glm::translate(glm::vec3(-3.5f, -2.5f, 3.5f));
pyramid.draw(color(0.0f, 0.0f, 1.0f, 1.0f));
// Set modeling transformation for the back right pyramid
modelingTransformation = glm::translate(glm::vec3(3.5f, -2.5f, -3.5f));
pyramid.draw(color(0.0f, 0.0f, 1.0f, 1.0f));
// Set modeling transformation for the center pyramid
modelingTransformation = glm::translate(glm::vec3(0.0f, 0.0f, 0.0f)) * glm::rotate(angle,glm::vec3(0.0f, 1.0f, 0.0f));
pyramid.draw(color(1.0f, 0.0f, 0.0f, 1.0f));
// Set modeling transformation for the right hand pyramid
modelingTransformation = glm::translate(glm::vec3(3.0f, 0.0f, 0.0f)) * glm::rotate(angle, glm::vec3(1.0f, 0.0f, 0.0f));
sphere.draw( color(1.0f, 1.0f, 0.0f, 1.0f));
// Set modeling transformation for the left hand pyramid
modelingTransformation = glm::translate(glm::vec3(-3.0f, 0.0f, 0.0f)) * glm::rotate(angle, glm::vec3(0.0f, 0.0f, 1.0f)) * glm::scale(glm::vec3(2.0f, 2.0f, 2.0f));
pyramid.draw( color(1.0f, 0.0f, 1.0f, 1.0f));
// Set modeling transformation for the orbiting pyramid
modelingTransformation = glm::rotate(angle, glm::vec3(0.0f, 1.0f, 0.0f))* glm::translate(glm::vec3(10.0f, 3.0f, 0.0f)) *glm::rotate(-angle, glm::vec3(1.0f, 0.0f, 0.0f));
pyramid.draw( color(1.0f, 1.0f, 1.0f, 1.0f));
// Display the color buffer
colorBuffer.showColorBuffer();
} // end RenderSceneCB
示例3: main
int main() {
sf::ContextSettings set;
set.antialiasingLevel = 8;
sf::Window w(sf::VideoMode(700, 700), "ogl", sf::Style::Default, set);
glewExperimental = true;
glewInit();
Context gl;
gl.ClearColor(0.0, 0.0, 0.0, 1.0);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.Enable(Capability::Blend);
w.setMouseCursorVisible(false);
Pyramid pyramid { w };
bool running = true;
while(running) {
sf::Event e;
while(w.pollEvent(e)){
if(e.type == sf::Event::Closed){ running = false; }
if(e.type == sf::Event::KeyPressed) {
switch(e.key.code) {
case sf::Keyboard::Escape:
running = false;
break;
case sf::Keyboard::W: case sf::Keyboard::Up:
camera.forward();
break;
case sf::Keyboard::A: case sf::Keyboard::Left:
camera.left();
break;
case sf::Keyboard::S: case sf::Keyboard::Down:
camera.back();
break;
case sf::Keyboard::D: case sf::Keyboard::Right:
camera.right();
break;
default:
break;
}
}
if(e.type == sf::Event::MouseMoved) {
//idk
}
}
pyramid.update();
pyramid.draw(gl);
gl.Clear().ColorBuffer().DepthBuffer();
w.display();
}
return 0;
}
示例4: RenderSceneCB
/**
* Acts as the display function for the window.
*/
static void RenderSceneCB()
{
vector<glm::vec4> transformedVertices;
// Clear the color buffer
colorBuffer.clearColorBuffer();
static float angle = glm::radians(45.0f);
angle += glm::radians(0.1f);
// Set Modeling transformation for the reference plane
modelingTransformation = glm::translate(glm::vec3(0.0f, -3.0f, 0.0f));
gameBoard.draw();
// Set modeling transformation for the back right pyramid on top of cube
modelingTransformation = glm::translate(glm::vec3(3.5f, -1.5f, -3.5f));
pyramid.draw(color(0.502f, 0.0f, 0.502f, 1.0f));
//cube under pyramid
modelingTransformation = glm::translate(glm::vec3(3.5f, -2.5f, -3.5f));
cube.draw(color(0.502f, 0.0f, 0.502f, 1.0f));
// Set modeling transformation for the center pyramid
modelingTransformation = glm::translate(glm::vec3(-0.5f, -2.5f, -0.5f));
cube.draw(color(0.0f, 1.0f, 0.0f, 1.0f));
// Set modeling transformation for the center pyramid
modelingTransformation = glm::translate(glm::vec3(0.5f, -2.5f, -0.5f));
cube.draw(color(1.0f, 1.0f, 0.0f, 1.0f));
// red cube
modelingTransformation = glm::translate(glm::vec3(0.0f, -2.5f, 0.5f));
cube.draw(color(1.0f, 0.0f, 0.0f, 1.0f));
// Set modeling transformation for the center pyramid
modelingTransformation = glm::translate(glm::vec3(0.0f, -1.5f, 0.0f))*glm::rotate(4.0f, glm::vec3(0.0f, 1.0f, 0.0f));;
cube.draw(color(0.0f, 0.0f, 1.0f, 1.0f));
// Display the color buffer
colorBuffer.showColorBuffer();
} // end RenderSceneCB