本文整理汇总了C++中Trackball::getRotationMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Trackball::getRotationMatrix方法的具体用法?C++ Trackball::getRotationMatrix怎么用?C++ Trackball::getRotationMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trackball
的用法示例。
在下文中一共展示了Trackball::getRotationMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
material_0._transparency = 1.0;
// Add the material to the apperance object
apperance_0->setMaterial(material_0);
//************************************************************************************************
// Add a texture
GLMultiTexture* texture = new GLMultiTexture();
int texid = texture->loadAndCreateTextures("../../data/textures/texture_deathstar.bmp", "../../data/textures/texture_wolf.bmp", "../../data/textures/gradient.bmp");
//int texid = texture->loadAndCreateTexture("../../data/textures/texture_earth_128x128_a.bmp");
apperance_0->setTexture(texture);
//************************************************************************************************
// Finalize the appearance object
apperance_0->finalize();
// create the sphere geometry
GLPlane3D* plane_0 = new GLPlane3D(0.0, 0.0, 0.0, 50.0, 50.0);
plane_0->setApperance(*apperance_0);
plane_0->init();
// If you want to change appearance parameters after you init the object, call the update function
apperance_0->updateLightSources();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Main render loop
// Set up our green background color
static const GLfloat clear_color[] = { 0.0f, 0.0f, 0.0f, 1.0f };
static const GLfloat clear_depth[] = { 1.0f, 1.0f, 1.0f, 1.0f };
// This sets the camera to a new location
// the first parameter is the eye position, the second the center location, and the third the up vector.
SetViewAsLookAt(glm::vec3(12.0f, 12.0f, 65.5f), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
// Enable depth test
// ignore this line, it allows us to keep the distance value after we proejct each object to a 2d canvas.
glEnable(GL_DEPTH_TEST);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Blending
// Enable blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// sphere->enableNormalVectorRenderer();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Main render loop
// This is our render loop. As long as our window remains open (ESC is not pressed), we'll continue to render things.
while(!glfwWindowShouldClose(window))
{
// Clear the entire buffer with our green color (sets the background to be green).
glClearBufferfv(GL_COLOR , 0, clear_color);
glClearBufferfv(GL_DEPTH , 0, clear_depth);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// This renders the objects
// Set the trackball locatiom
SetTrackballLocation(trackball.getRotationMatrix());
// draw the objects
cs->draw();
plane_0->draw();
// change the texture appearance blend mode
bool ret = texture->setTextureBlendMode(g_change_texture_blend);
if(ret)apperance_0->updateTextures();
//// This renders the objects
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Swap the buffers so that what we drew will appear on the screen.
glfwSwapBuffers(window);
glfwPollEvents();
}
delete cs;
}
示例2: main
int main(int argc, const char * argv[])
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Init glfw, create a window, and init glew
// Init the GLFW Window
window = initWindow();
// Init the glew api
initGlew();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Create some models
// coordinate system
CoordSystem* cs = new CoordSystem(40.0);
GLSphereSpot* sphere = new GLSphereSpot(0.0, 0.0, 0.0, 10.0, 90, 50);
//GLSphereDirect* sphere = new GLSphereDirect(0.0, 0.0, 0.0, 10.0, 40, 20);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Main render loop
// Set up our green background color
static const GLfloat clear_color[] = { 0.0f, 0.0f, 0.0f, 1.0f };
static const GLfloat clear_depth[] = { 1.0f, 1.0f, 1.0f, 1.0f };
// This sets the camera to a new location
// the first parameter is the eye position, the second the center location, and the third the up vector.
SetViewAsLookAt(glm::vec3(12.0f, 12.0f, 15.5f), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
// Enable depth test
// ignore this line, it allows us to keep the distance value after we proejct each object to a 2d canvas.
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT1);
//sphere->enableNormalVectorRenderer();
// This is our render loop. As long as our window remains open (ESC is not pressed), we'll continue to render things.
while(!glfwWindowShouldClose(window))
{
// Clear the entire buffer with our green color (sets the background to be green).
glClearBufferfv(GL_COLOR , 0, clear_color);
glClearBufferfv(GL_DEPTH , 0, clear_depth);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// This renders the objects
// Set the trackball locatiom
SetTrackballLocation(trackball.getRotationMatrix());
// draw the objects
cs->draw();
sphere->draw();
//// This renders the objects
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Swap the buffers so that what we drew will appear on the screen.
glfwSwapBuffers(window);
glfwPollEvents();
}
delete cs;
}