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


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

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


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

示例1: NonASCIIKeyboardPress

void NonASCIIKeyboardPress(int key, int mouseXPosition, int mouseYPosition)
{	
  switch (key) {
    case UP_KEY:
      cameraFrame.MoveForward(CAMERA_LINEAR_STEP);
      break;

    case DOWN_KEY:
      cameraFrame.MoveForward(-CAMERA_LINEAR_STEP);
      break;

    case LEFT_KEY:
      cameraFrame.RotateWorld(CAMERA_ANGULAR_STEP, 0.0f, 1.0f, 0.0f);
      break;

    case RIGHT_KEY:
      cameraFrame.RotateWorld(-CAMERA_ANGULAR_STEP, 0.0f, 1.0f, 0.0f);
      break;

    case F1_KEY:
      fullscreen = !fullscreen;
      fullscreen ? glutFullScreen() : glutReshapeWindow(ORIG_WINDOW_SIZE[0], ORIG_WINDOW_SIZE[1]);
      break;

    default:
      break;
  }
}
开发者ID:marksands,项目名称:Themepark,代码行数:28,代码来源:FerrisWheelTextured.cpp

示例2: SpecialKeys

void SpecialKeys(int key, int x, int y)
{
	float linear = 0.1f;
	float angular = float(m3dDegToRad(5.0f));

	if (key == GLUT_KEY_UP)
	{
		cameraFrame.MoveForward(linear);
	}

	if (key == GLUT_KEY_DOWN)
	{
		cameraFrame.MoveForward(-linear);
	}

	if (key == GLUT_KEY_LEFT)
	{
		cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
	}

	if (key == GLUT_KEY_RIGHT)
	{
		cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
	}
}
开发者ID:wjingzhe,项目名称:OpenGL_SB5_static,代码行数:25,代码来源:SphereWorld.cpp

示例3: SpecialKeys

// called on arrow keys
void SpecialKeys(int key, int x, int y){
    float linear = 0.1f;
    float angular = float(m3dDegToRad(5.0f));

    // TODO - flatten movement to the XZ axis

    if(key == GLUT_KEY_UP)
        cameraFrame.MoveForward(linear);
    if(key == GLUT_KEY_DOWN)
        cameraFrame.MoveForward(-linear);
    if(key == GLUT_KEY_LEFT)
        cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
    if(key == GLUT_KEY_RIGHT)
        cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
}
开发者ID:deckycoss,项目名称:Audio-Visualizer,代码行数:16,代码来源:graphics_helper.cpp

示例4: SetupRC

// This function does any needed initialization on the rendering context.
static void SetupRC(void)
{
    // Background
    glClearColor(0.2f, 0.2f, 0.3f, 1.0f );

    glEnable(GL_DEPTH_TEST);

    shaderManager.InitializeStockShaders();
    viewFrame.MoveForward(4.0f);

    // Make the torus
    gltMakeTorus(torusBatch, .70f, 0.30f, 32, 16);

    cullingShader = gltLoadShaderTripletWithAttributes("../../Data/Shaders/Chapter11/GSCulling.vs",
                                                       "../../Data/Shaders/Chapter11/GSCulling.gs",
                                                       "../../Data/Shaders/Chapter11/GSCulling.fs",
                                                       2,
                                                       GLT_ATTRIBUTE_VERTEX, "vVertex",
                                                       GLT_ATTRIBUTE_NORMAL, "vNormal");

    locMVP = glGetUniformLocation(cullingShader, "mvpMatrix");
    locMV  = glGetUniformLocation(cullingShader, "mvMatrix");
    locNM  = glGetUniformLocation(cullingShader, "normalMatrix");
    locViewpoint = glGetUniformLocation(cullingShader, "viewpoint");
}
开发者ID:rswinkle,项目名称:oglsuperbible5,代码行数:26,代码来源:GSCulling.cpp

示例5: SetupRC

// This function does any needed initialization on the rendering
// context. 
void SetupRC(void)
	{
	// Background
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);

    shaderManager.InitializeStockShaders();
    viewFrame.MoveForward(4.0f);

    // Make the sphere
    gltMakeSphere(sphereBatch, 1.0f, 52, 26);

	normalMapShader = gltLoadShaderPairWithAttributes("NormalMapped\\NormalMapped.vp", "NormalMapped\\NormalMapped.fp", 3, GLT_ATTRIBUTE_VERTEX, "vVertex",
			GLT_ATTRIBUTE_NORMAL, "vNormal", GLT_ATTRIBUTE_TEXTURE0, "vTexture0");

	locAmbient = glGetUniformLocation(normalMapShader, "ambientColor");
	locDiffuse = glGetUniformLocation(normalMapShader, "diffuseColor");
	locLight = glGetUniformLocation(normalMapShader, "vLightPosition");
	locMVP = glGetUniformLocation(normalMapShader, "mvpMatrix");
	locMV  = glGetUniformLocation(normalMapShader, "mvMatrix");
	locNM  = glGetUniformLocation(normalMapShader, "normalMatrix");
	locColorMap = glGetUniformLocation(normalMapShader, "colorMap");
    locNormalMap = glGetUniformLocation(normalMapShader, "normalMap");

	glGenTextures(2, texture);
    glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, texture[0]);
	LoadTGATexture("NormalMapped\\IceMoon.tga", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, texture[1]);
    LoadTGATexture("NormalMapped\\IceMoonBump.tga", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_REPEAT);
	}
开发者ID:marblep,项目名称:OpenGL,代码行数:36,代码来源:NormalMapped.cpp

示例6: SetupRC

void SetupRC()
{
    // Background
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

    viewFrame.MoveForward(4.0f);

    shaderManager.InitializeStockShaders();

    // Simple triangle
    // Load up a triangle
    GLfloat vVerts[] = {
      -0.5f, 0.0f, 0.0f,
      0.5f, 0.0f, 0.0f,
      0.0f, 0.5f, 0.0f
    };

    GLfloat vTexCoords [] = {
      0.0f, 0.0f,
      1.0f, 0.0f,
      0.5f, 1.0f
    };

    triangleBatch.Begin(GL_TRIANGLES, 3, 1);
    triangleBatch.CopyVertexData3f(vVerts);
    triangleBatch.CopyTexCoordData2f(vTexCoords, 0);
    triangleBatch.End();

    texturedIdentity = gltLoadShaderPairWithAttributes("TexturedIdentity.vp", "TexturedIdentity.fp", 2, GLT_ATTRIBUTE_VERTEX, "vVertex", GLT_ATTRIBUTE_TEXTURE0, "vTexCoords");

    glGenTextures(1, &stoneTexture);
    glBindTexture(GL_TEXTURE_2D, stoneTexture);
    LoadTGATexture("Stone.tga", GL_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
开发者ID:ninkendo,项目名称:glbook,代码行数:34,代码来源:TexturedTriangle.cpp

示例7: setupRC

void setupRC()
{
	expCounter = counterLoader();

	//BG:
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	//Enable depth testing so things won't look effed up:
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR);

	//Initialize stock shaders from GLTools:
	shaderManager.InitializeStockShaders();
	
	//Move cam back:
	cameraFrame.MoveForward(-30.0f);
	cameraFrame.MoveRight(-5.0f);
	cameraFrame.MoveUp(-8.0f);

	newDeskButton.init(20, 80, 165, 70, "Assets/button_new_desk165x70.tga");
	removeDeskButton.init(208, 80, 175, 67, "Assets/button_remove_desk175x67.tga");
	exportButton.init(403, 80, 168, 67, "Assets/button_export168x67.tga");

	M3DVector4f deskShine = {0.5, 0.5, 0.5, 1.0};
	M3DVector4f deskColor = {0.0f, 0.0f, 0.5f, 1.0f};

	hlGrid.init(0.0f, 0.0f, 0.0f, C_DM/2);
	cRoom.init();
	stuDesks.init(deskColor, deskShine, C_DM/2);
}
开发者ID:Errim,项目名称:Datorsalsplaneraren,代码行数:31,代码来源:main.cpp

示例8: SetupRC

// This function does any needed initialization on the rendering
// context. 
void SetupRC(void)
	{
	// Background
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);

    shaderManager.InitializeStockShaders();
    viewFrame.MoveForward(4.0f);

    // Make the sphere
    gltMakeSphere(sphereBatch, 1.0f, 26, 13);

	ADSLightShader = shaderManager.LoadShaderPairWithAttributes("ADSGouraud.vp", "ADSGouraud.fp", 2, GLT_ATTRIBUTE_VERTEX, "vVertex",
			GLT_ATTRIBUTE_NORMAL, "vNormal");

	locAmbient = glGetUniformLocation(ADSLightShader, "ambientColor");
	locDiffuse = glGetUniformLocation(ADSLightShader, "diffuseColor");
	locSpecular = glGetUniformLocation(ADSLightShader, "specularColor");
	locLight = glGetUniformLocation(ADSLightShader, "vLightPosition");
	locMVP = glGetUniformLocation(ADSLightShader, "mvpMatrix");
	locMV  = glGetUniformLocation(ADSLightShader, "mvMatrix");
	locNM  = glGetUniformLocation(ADSLightShader, "normalMatrix");
	}
开发者ID:zsutxz,项目名称:SuperBible5_src,代码行数:27,代码来源:ADSGouraud.cpp

示例9: SetupRC

// This function does any needed initialization on the rendering
// context. 
void SetupRC(void)
	{
	// Background
	glClearColor(0.025f, 0.25f, 0.25f, 1.0f );

	glEnable(GL_DEPTH_TEST);

    shaderManager.InitializeStockShaders();
    viewFrame.MoveForward(4.0f);

    // Make the torus
    gltMakeTorus(torusBatch, .80f, 0.25f, 52, 26);

	toonShader = gltLoadShaderPairWithAttributes("ToonShader.vp", "ToonShader.fp", 2, GLT_ATTRIBUTE_VERTEX, "vVertex",
			GLT_ATTRIBUTE_NORMAL, "vNormal");

	locLight = glGetUniformLocation(toonShader, "vLightPosition");
	locMVP = glGetUniformLocation(toonShader, "mvpMatrix");
	locMV  = glGetUniformLocation(toonShader, "mvMatrix");
	locNM  = glGetUniformLocation(toonShader, "normalMatrix");
	locColorTable = glGetUniformLocation(toonShader, "colorTable");

	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_1D, texture);
	GLubyte textureData[4][3] = { 32,  0, 0,
                                  64,  0, 0,
								  128, 0, 0,
								  255, 0, 0};

	glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 4, 0, GL_RGB, GL_UNSIGNED_BYTE, textureData);
	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	}
开发者ID:zsutxz,项目名称:SuperBible5_src,代码行数:36,代码来源:ToonShader.cpp

示例10: SetupRC

// This function does any needed initialization on the rendering context.
void SetupRC(void)
{
    // Background
    glClearColor(0.2f, 0.2f, 0.3f, 1.0f );

    glEnable(GL_DEPTH_TEST);

    shaderManager.InitializeStockShaders();
    viewFrame.MoveForward(4.0f);

    // Make the torus
    gltMakeTorus(torusBatch, .70f, 0.10f, 11, 7);

    explodeProgram = gltLoadShaderTripletWithAttributes("../../Data/Shaders/Chapter11/GSExplode.vs",
                                                        "../../Data/Shaders/Chapter11/GSExplode.gs",
                                                        "../../Data/Shaders/Chapter11/GSExplode.fs",
                                                        2,
                                                        GLT_ATTRIBUTE_VERTEX, "vVertex",
                                                        GLT_ATTRIBUTE_NORMAL, "vNormal");

    locMVP = glGetUniformLocation(explodeProgram, "mvpMatrix");
    locMV  = glGetUniformLocation(explodeProgram, "mvMatrix");
    locNM  = glGetUniformLocation(explodeProgram, "normalMatrix");
    locPushOut = glGetUniformLocation(explodeProgram, "push_out");
}
开发者ID:coolsee,项目名称:opengl,代码行数:26,代码来源:GSExplode.cpp

示例11: SetupRC

// This function does any needed initialization on the rendering
// context. 
void SetupRC(void)
	{
	// Background
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

	glEnable(GL_DEPTH_TEST);

    shaderManager.InitializeStockShaders();
    viewFrame.MoveForward(4.0f);

    // Make the torus
    gltMakeTorus(torusBatch, .80f, 0.25f, 52, 26);

	ADSDissloveShader = gltLoadShaderPairWithAttributes("Dissolve.vp", "Dissolve.fp", 3, GLT_ATTRIBUTE_VERTEX, "vVertex",
			GLT_ATTRIBUTE_NORMAL, "vNormal", GLT_ATTRIBUTE_TEXTURE0, "vTexCoords0");

	locAmbient = glGetUniformLocation(ADSDissloveShader, "ambientColor");
	locDiffuse = glGetUniformLocation(ADSDissloveShader, "diffuseColor");
	locSpecular = glGetUniformLocation(ADSDissloveShader, "specularColor");
	locLight = glGetUniformLocation(ADSDissloveShader, "vLightPosition");
	locMVP = glGetUniformLocation(ADSDissloveShader, "mvpMatrix");
	locMV  = glGetUniformLocation(ADSDissloveShader, "mvMatrix");
	locNM  = glGetUniformLocation(ADSDissloveShader, "normalMatrix");
	locTexture = glGetUniformLocation(ADSDissloveShader, "cloudTexture");
	locDissolveFactor = glGetUniformLocation(ADSDissloveShader, "dissolveFactor");

	glGenTextures(1, &cloudTexture);
	glBindTexture(GL_TEXTURE_1D, cloudTexture);
	LoadTGATexture("Clouds.tga", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE);
	}
开发者ID:marblep,项目名称:OpenGL,代码行数:32,代码来源:Dissolve.cpp

示例12: 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

示例13: movingCylinder

void movingCylinder()
{

    static CStopWatch cameraTimer;
    float fTime = cameraTimer.GetElapsedSeconds();
    cameraTimer.Reset();

    float linear = fTime * 3.0f;
    float angular = fTime * float(m3dDegToRad(15.0f));

    if(isMoveForward == true) cameraFrame.MoveForward(linear);
    if(isMoveBack == true) cameraFrame.MoveForward(-linear);
    if(isRotateLeft == true) cameraFrame.RotateWorld(angular, 0.0f, 1.0f, 0.0f);
    if(isRotateRight == true) cameraFrame.RotateWorld(-angular, 0.0f, 1.0f, 0.0f);
    if(isRotateUp == true) cameraFrame.RotateWorld(angular, 1.0f, 0.0f, 0.0f);
    if(isRotateDown == true) cameraFrame.RotateWorld(-angular, 1.0f, 0.0f, 0.0f);
}
开发者ID:ybbai,项目名称:workspace,代码行数:17,代码来源:fbotextures.cpp

示例14: SpecialKeys

// Respond to arrow keys by moving the camera frame of reference
void SpecialKeys(int key, int x, int y)
    {
    if(key == GLUT_KEY_UP)
        viewFrame.MoveForward(0.1f);

    if(key == GLUT_KEY_DOWN)
        viewFrame.MoveForward(-0.1f);

    if(key == GLUT_KEY_LEFT)
        viewFrame.RotateLocalY(0.1);
      
    if(key == GLUT_KEY_RIGHT)
        viewFrame.RotateLocalY(-0.1);
                        
    // Refresh the Window
    glutPostRedisplay();
    }
开发者ID:zsutxz,项目名称:SuperBible5_src,代码行数:18,代码来源:Cubemap.cpp

示例15: keyFunc

void keyFunc(int key, int x, int y)
{
    static const float step = 0.1f;
    static const float angle = m3dDegToRad(4);
    switch (key)
    {
    case GLUT_KEY_UP:
        objectFrame.RotateWorld(-angle, 1, 0, 0);
        break;

    case GLUT_KEY_DOWN:
        objectFrame.RotateWorld(angle, 1, 0, 0);
        break;

    case GLUT_KEY_LEFT:
        objectFrame.RotateWorld(-angle, 0, 1, 0);
        break;

    case GLUT_KEY_RIGHT:
        objectFrame.RotateWorld(angle, 0, 1, 0);
        break;

    case GLUT_KEY_HOME:
        cameraFrame.MoveForward(step);
        break;

    case GLUT_KEY_END:
        cameraFrame.MoveForward(-step);
        break;

    // enable/disable anisotropy
    case GLUT_KEY_F1:
        if (isAnisotropySupported) {
            isAnisotropy = !isAnisotropy;
            if (isAnisotropy)
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest);
            else
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
        }
        break;
    default:
        break;
    }

    glutPostRedisplay();
}
开发者ID:tailnode,项目名称:chaos,代码行数:46,代码来源:main.cpp


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