当前位置: 首页>>代码示例>>C++>>正文


C++ GLFrame::RotateLocalX方法代码示例

本文整理汇总了C++中GLFrame::RotateLocalX方法的典型用法代码示例。如果您正苦于以下问题:C++ GLFrame::RotateLocalX方法的具体用法?C++ GLFrame::RotateLocalX怎么用?C++ GLFrame::RotateLocalX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLFrame的用法示例。


在下文中一共展示了GLFrame::RotateLocalX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mouseCameraFunc

void mouseCameraFunc(int x, int y)
{
	if (mouseActive)
	{
		GLfloat angle = 0.005f;

		if (x > W_WIDTH/2)
		{
			cameraFrame.RotateWorld(-angle*(x-W_WIDTH/2), 0, 0, 1);
			glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
		}
		else if (x < W_WIDTH/2)
		{
			cameraFrame.RotateWorld(angle*(W_WIDTH/2-x), 0, 0, 1);
			glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
		}
		if (y > W_HEIGHT/2 && pitch < 90)
		{
			cameraFrame.RotateLocalX(-angle*(W_HEIGHT/2-y));
			glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
			pitch = pitch + (-angle*(W_HEIGHT/2-y));
		}
		else if (y < W_HEIGHT/2 && pitch > -90)
		{
			cameraFrame.RotateLocalX(angle*(y-W_HEIGHT/2));
			glutWarpPointer(W_WIDTH/2, W_HEIGHT/2);
			pitch = pitch + (angle*(y-W_HEIGHT/2));
		}
	}
}
开发者ID:Errim,项目名称:Datorsalsplaneraren,代码行数:30,代码来源:main.cpp

示例2: SpecialKeys

void SpecialKeys(int key, int x, int y)
    {

	if(key == GLUT_KEY_F1)
        frameCamera.MoveForward(1.0f);

	if(key == GLUT_KEY_F2)
        frameCamera.MoveForward(-1.0f);

    if(key == GLUT_KEY_DOWN)
        frameCamera.RotateLocalX(0.01f);

	if(key == GLUT_KEY_UP)
        frameCamera.RotateLocalX(-0.01f);

    if(key == GLUT_KEY_LEFT)
        frameCamera.RotateLocalY(0.01f);
      
    if(key == GLUT_KEY_RIGHT)
        frameCamera.RotateLocalY(-0.01f);
    /*if(key == GLUT_KEY_UP)
        xRot-= 5.0f;

    if(key == GLUT_KEY_DOWN)
        xRot += 5.0f;

    if(key == GLUT_KEY_LEFT)
        yRot -= 5.0f;

    if(key == GLUT_KEY_RIGHT)
        yRot += 5.0f;

    if(key > 356.0f)
        xRot = 0.0f;

    if(key < -1.0f)
        xRot = 355.0f;

    if(key > 356.0f)
        yRot = 0.0f;

    if(key < -1.0f)
        yRot = 355.0f;*/

    // Refresh the Window
    glutPostRedisplay();
    }
开发者ID:boztalay,项目名称:OldProjects,代码行数:47,代码来源:Main.cpp

示例3: SetupRC

///////////////////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering context. 
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
{
    GLbyte *pBytes;
    GLint nWidth, nHeight, nComponents;
    GLenum format;

    shaderManager.InitializeStockShaders();

    // Black background
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
    glEnable(GL_DEPTH_TEST);
    glLineWidth(2.5f);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);

    transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);

    cameraFrame.MoveForward(-15.0f);
    cameraFrame.MoveUp(6.0f);
    cameraFrame.RotateLocalX(float(m3dDegToRad(20.0f)));
    
    MakeCube(cubeBatch);
    MakeFloor(floorBatch);

    // Make top
    topBlock.Begin(GL_TRIANGLE_FAN, 4, 1);
        topBlock.Normal3f(0.0f, 1.0f, 0.0f);
        topBlock.MultiTexCoord2f(0, 0.0f, 0.0f);
        topBlock.Vertex3f(-1.0f, 1.0f, 1.0f);

        topBlock.Normal3f(0.0f, 1.0f, 0.0f);
        topBlock.MultiTexCoord2f(0, 1.0f, 0.0f);
        topBlock.Vertex3f(1.0f, 1.0f, 1.0f);

        topBlock.Normal3f(0.0f, 1.0f, 0.0f);
        topBlock.MultiTexCoord2f(0, 1.0f, 1.0f);
        topBlock.Vertex3f(1.0f, 1.0f, -1.0f);

        topBlock.Normal3f(0.0f, 1.0f, 0.0f);
        topBlock.MultiTexCoord2f(0, 0.0f, 1.0f);
        topBlock.Vertex3f(-1.0f, 1.0f, -1.0f);
    topBlock.End();

    // Make Front
    frontBlock.Begin(GL_TRIANGLE_FAN, 4, 1);
        frontBlock.Normal3f(0.0f, 0.0f, 1.0f);
        frontBlock.MultiTexCoord2f(0, 0.0f, 0.0f);
        frontBlock.Vertex3f(-1.0f, -1.0f, 1.0f);

        frontBlock.Normal3f(0.0f, 0.0f, 1.0f);
        frontBlock.MultiTexCoord2f(0, 1.0f, 0.0f);
        frontBlock.Vertex3f(1.0f, -1.0f, 1.0f);

        frontBlock.Normal3f(0.0f, 0.0f, 1.0f);
        frontBlock.MultiTexCoord2f(0, 1.0f, 1.0f);
        frontBlock.Vertex3f(1.0f, 1.0f, 1.0f);

        frontBlock.Normal3f(0.0f, 0.0f, 1.0f);
        frontBlock.MultiTexCoord2f(0, 0.0f, 1.0f);
        frontBlock.Vertex3f(-1.0f, 1.0f, 1.0f);
    frontBlock.End();

    // Make left
    leftBlock.Begin(GL_TRIANGLE_FAN, 4, 1);
        leftBlock.Normal3f(-1.0f, 0.0f, 0.0f);
        leftBlock.MultiTexCoord2f(0, 0.0f, 0.0f);
        leftBlock.Vertex3f(-1.0f, -1.0f, -1.0f);

        leftBlock.Normal3f(-1.0f, 0.0f, 0.0f);
        leftBlock.MultiTexCoord2f(0, 1.0f, 0.0f);
        leftBlock.Vertex3f(-1.0f, -1.0f, 1.0f);

        leftBlock.Normal3f(-1.0f, 0.0f, 0.0f);
        leftBlock.MultiTexCoord2f(0, 1.0f, 1.0f);
        leftBlock.Vertex3f(-1.0f, 1.0f, 1.0f);

        leftBlock.Normal3f(-1.0f, 0.0f, 0.0f);
        leftBlock.MultiTexCoord2f(0, 0.0f, 1.0f);
        leftBlock.Vertex3f(-1.0f, 1.0f, -1.0f);
    leftBlock.End();

    // Create shadow projection matrix
    GLfloat floorPlane[] = { 0.0f, 1.0f, 0.0f, 1.0f};
    m3dMakePlanarShadowMatrix(shadowMatrix, floorPlane, vLightPos);

    // Load up four textures  
    glGenTextures(4, textures);
        
    // Wood floor
    pBytes = gltReadTGABits("floor.tga", &nWidth, &nHeight, &nComponents, &format);
    glBindTexture(GL_TEXTURE_2D, textures[0]);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexImage2D(GL_TEXTURE_2D,0,nComponents,nWidth, nHeight, 0,
        format, GL_UNSIGNED_BYTE, pBytes);
//.........这里部分代码省略.........
开发者ID:1085075003,项目名称:oglsuperbible5,代码行数:101,代码来源:Block_redux.cpp


注:本文中的GLFrame::RotateLocalX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。