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


C++ MyMesh::Render方法代码示例

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


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

示例1: drawMesh

void drawMesh(int x, int y, int width, int height){
	MyGraphicsTool::SetViewport(MyVec4i(x, y, width, height));
	glPushMatrix(); {
		MyGraphicsTool::LoadTrackBall(&trackBall);
		MyGraphicsTool::Rotate(180, MyVec3f(0, 1, 0));
		MyBoundingBox box = mesh.GetBoundingBox();
		MyGraphicsTool::Translate(-box.GetCenter());
		mesh.Render();
	}glPopMatrix();
}
开发者ID:edgeofmoon,项目名称:Rendering,代码行数:10,代码来源:parameterTest.cpp

示例2: main

int main(void)
{
	// Initialise GLFW
	if (!glfwInit())
	{
		fprintf(stderr, "Failed to initialize GLFW\n");
		return -1;
	}

	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

	// Open a window and create its OpenGL context
	window = glfwCreateWindow(1024, 768, "MyMesh class", NULL, NULL);
	if (window == NULL){
		fprintf(stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n");
		glfwTerminate();
		return -1;
	}
	glfwMakeContextCurrent(window);

	// Initialize GLEW
	glewExperimental = true; // Needed for core profile
	if (glewInit() != GLEW_OK) {
		fprintf(stderr, "Failed to initialize GLEW\n");
		return -1;
	}

	// Ensure we can capture the escape key being pressed below
	glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

	// Dark blue background
	glClearColor(0.0f, 0.0f, 0.4f, 0.0f);

	MyMesh* pMesh = new MyMesh();

	pMesh->AddVertexPosition(glm::vec3(-5.0f, -2.5f, 0.0f));
	pMesh->AddVertexPosition(glm::vec3(5.0f, -2.5f, 0.0f));
	pMesh->AddVertexPosition(glm::vec3(0.0f, 2.5f, 0.0f));

	pMesh->AddVertexColor(glm::vec3(1.0f, 1.0f, 0.0f));
	pMesh->AddVertexColor(glm::vec3(1.0f, 0.0f, 0.0f));
	pMesh->AddVertexColor(glm::vec3(0.0f, 1.0f, 0.0f));

	pMesh->CompileOpenGL3X();
	//glEnable(GL_DEPTH_TEST);
	do{

		// Clear the screen
		glClear(GL_COLOR_BUFFER_BIT);

		pMesh->Render(glm::mat4(1.0f));

		// Swap buffers
		glfwSwapBuffers(window);
		glfwPollEvents();

	} // Check if the ESC key was pressed or the window was closed
	while (glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS &&
	glfwWindowShouldClose(window) == 0);

	// Close OpenGL window and terminate GLFW
	glfwTerminate();

	delete pMesh;

	return 0;
}
开发者ID:ntancredi,项目名称:ReEngineApp_2015s,代码行数:70,代码来源:Main.cpp


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