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


C++ DrawMesh函数代码示例

本文整理汇总了C++中DrawMesh函数的典型用法代码示例。如果您正苦于以下问题:C++ DrawMesh函数的具体用法?C++ DrawMesh怎么用?C++ DrawMesh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Render

/**-----------------------------------------------------------------------------
 * 화면 그리기
 *------------------------------------------------------------------------------
 */
VOID Render()
{
    /// 후면버퍼와 Z버퍼 초기화
    g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(200,200,200), 1.0f, 0 );

	/// 애니메이션 행렬설정
	Animate();
    /// 렌더링 시작
    if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
    {
		g_pd3dDevice->SetTexture( 0, g_pTexDiffuse );							/// 0번 텍스쳐 스테이지에 텍스쳐 고정(색깔맵)
		g_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );	/// 0번 텍스처 스테이지의 확대 필터
		g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 );		/// 0번 텍스처 : 0번 텍스처 인덱스 사용

		g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE);
		g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
		g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );

		DrawMesh( &g_matAni );
		if ( !g_bHideFrustum )
		{
			g_pFrustum->Draw( g_pd3dDevice );
		}

		/// 렌더링 종료
		g_pd3dDevice->EndScene();
    }

    /// 후면버퍼를 보이는 화면으로!
    g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
开发者ID:blastingzone,项目名称:ComputerGraphicsAdvenced,代码行数:35,代码来源:HeightMap.cpp

示例2: glUseProgram

/*!****************************************************************************
 @Function		DrawBalloons
 @Input			psProgram			Program to use
				mProjection			Projection matrix to use
				mView				View matrix to use
				pmModels			A pointer to an array of model matrices
				iNum				Number of balloons to draw
 @Description	Draws balloons.
******************************************************************************/
void OGLES2Glass::DrawBalloons(Program* psProgram, PVRTMat4 mProjection, PVRTMat4 mView, PVRTMat4* pmModels, int iNum) {
	// Use shader program
	glUseProgram(psProgram->uiId);

	// Bind texture
	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, m_uiBalloonTex);

	PVRTMat4 mModelView, mMVP;

	for (int i = 0; i < iNum; ++i)
	{
		mModelView = mView * pmModels[i];
		mMVP =  mProjection * mModelView;
	
		glUniformMatrix4fv(psProgram->auiLoc[eMVMatrix], 1, GL_FALSE, mModelView.ptr());
		glUniformMatrix4fv(psProgram->auiLoc[eMVPMatrix], 1, GL_FALSE, mMVP.ptr());

		// Calculate and set the model space light direction
		PVRTVec3 vLightDir = pmModels[i].inverse() * PVRTVec4(19, 22, -50, 0);
		vLightDir = vLightDir.normalize();
		glUniform3fv(psProgram->auiLoc[eLightDir], 1, vLightDir.ptr());

		// Calculate and set the model space eye position
		PVRTVec3 vEyePos = mModelView.inverse() * PVRTVec4(0.0f, 0.0f, 0.0f, 1.0f);
		glUniform3fv(psProgram->auiLoc[eEyePos], 1, vEyePos.ptr());

		// Now that the uniforms are set, call another function to actually draw the mesh.
		DrawMesh(0, &m_Balloon, &m_puiBalloonVbo, &m_puiBalloonIndexVbo, 3);
	}
}
开发者ID:deepbansal15,项目名称:Native_SDK,代码行数:40,代码来源:OGLES2Glass.cpp

示例3: guard

void CMeshViewer::Draw3D(float TimeDelta)
{
	guard(CMeshViewer::Draw3D);
	assert(Inst);

	if (GShowDebugInfo)
	{
		// draw axis
		BindDefaultMaterial(true);
		glBegin(GL_LINES);
		for (int i = 0; i < 3; i++)
		{
			CVec3 tmp = nullVec3;
			tmp[i] = 1;
			glColor3fv(tmp.v);
			tmp[i] = 70;
			glVertex3fv(tmp.v);
			glVertex3fv(nullVec3.v);
		}
		glEnd();
		glColor3f(1, 1, 1);
	}

	// draw mesh
	glPolygonMode(GL_FRONT_AND_BACK, Wireframe ? GL_LINE : GL_FILL);	//?? bWireframe is inside Inst, but used here only ?
	DrawMesh(Inst);

	unguard;
}
开发者ID:gildor2,项目名称:UModel,代码行数:29,代码来源:MeshViewer.cpp

示例4: main

int main() {

    Window window;
    Camera camera(window.GetAspectRatio(), glm::vec3(2.0, 2.0, 1.0));
    Mesh* sphereMesh = CreateMesh("sphere.obj", "sphere");
    Shader defaultShader("Shaders/defaultShader.vert", "Shaders/defaultShader.frag", "defaultShader");
    SetupMesh(sphereMesh, defaultShader);
    do {
        window.Clear();

        DrawMesh(*sphereMesh, camera, defaultShader);
        camera.front = sphereMesh->position;
        sphereMesh->rotY -= 0.016;
        {
            if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_W) == GLFW_PRESS) {
                sphereMesh->position.x -= 0.16;
            }
            else if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_S) == GLFW_PRESS) {
                sphereMesh->position.x += 0.16;
            }
            if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_A) == GLFW_PRESS) {
                sphereMesh->position.z += 0.16;
            }
            else if (glfwGetKey(window.GetWindowInstance(), GLFW_KEY_D) == GLFW_PRESS) {
                sphereMesh->position.z -= 0.16;
            }
        }
        window.Update();
    } while (!window.Closed() && glfwGetKey(window.GetWindowInstance(), GLFW_KEY_ESCAPE) != GLFW_PRESS);
    delete sphereMesh;
}
开发者ID:Raf22,项目名称:Snow,代码行数:31,代码来源:main.cpp

示例5: DrawShape

void DrawShape(NxShape* shape, const NxVec3& color)
{
    switch(shape->getType())
    {
		case NX_SHAPE_PLANE:
			DrawPlane(shape);
		break;
		case NX_SHAPE_BOX:
			DrawBox(shape, color);
		break;
		case NX_SHAPE_SPHERE:
			DrawSphere(shape, color);
		break;
		case NX_SHAPE_CAPSULE:
			DrawCapsule(shape, color);
		break;
		case NX_SHAPE_CONVEX:
			DrawConvex(shape, color);
		break;
		case NX_SHAPE_MESH:
			DrawMesh(shape, color);
		break;
		case NX_SHAPE_WHEEL:
			DrawWheelShape(shape);
		break;
		default:
		break;
	}
}
开发者ID:bitllorent,项目名称:CompAnim_P3,代码行数:29,代码来源:DrawObjects.cpp

示例6: Display

static void Display( void )
{
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

   glPushMatrix();
      glRotatef(Xrot, 1, 0, 0);
      glRotatef(Yrot, 0, 1, 0);
      glRotatef(Zrot, 0, 0, 1);

      /* Position the gravity source */
      {
         GLfloat x, y, z, r = 0.5;
         x = r * cos(Phi);
         y = r * sin(Phi);
         z = 1.0;
         glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 30, x, y, z, 1);
         glDisable(GL_VERTEX_PROGRAM_ARB);
         glBegin(GL_POINTS);
         glColor3f(1,1,1);
         glVertex3f(x, y, z);
         glEnd();
      }

      glEnable(GL_VERTEX_PROGRAM_ARB);
      DrawMesh(8, 8);
   glPopMatrix();

   glutSwapBuffers();
}
开发者ID:Distrotech,项目名称:mesa-demos,代码行数:29,代码来源:arbvpwarpmesh.c

示例7: MakeLamp

void MakeLamp(void)
{
   static GLfloat ambient_torus[3] = {	0.2125, 	0.1275, 	0.054};		// Torus
   static GLfloat diffuse_torus[3] = {0.714, 0.4284, 	0.18144};
   static GLfloat specular_torus[3]= {	0.393548, 	0.271906, 0.166721};
	  if(lamp_id != -1) {
	    glDeleteLists(lamp_id,1);
	  }
   lamp_id = glGenLists(1);
   glNewList(lamp_id, GL_COMPILE);
     glDisable(GL_TEXTURE_2D);
     glDepthMask (GL_FALSE);
 		  glMaterialfv(GL_FRONT,GL_AMBIENT, ambient_torus);
 		  glMaterialfv(GL_FRONT,GL_DIFFUSE, diffuse_torus);
 		  glMaterialfv(GL_FRONT,GL_SPECULAR, specular_torus);
 		  glMaterialf (GL_FRONT, GL_SHININESS, 76.8);

#ifdef USE_BINDBUFFER
     DrawMesh(vbo4, vinx4, FACES4_COUNT);
#else
     DrawMesh(FACES4_COUNT, (char *)&vertexs4, (char *)&indexes4);
#endif
     glDisable(GL_CULL_FACE);
     glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
     glRotatef(90.0,1.0,0.0,0.0);
     glTranslatef(-1.0,0.7,0.7);
     static const GLshort Vertices1[] = {0,0,0,0,12,0,2,0,0,2,12,0};
     static const GLshort ColorData1[] = {1,1,1,1,1,1,1,1,1,1,1,1};
     glEnableClientState(GL_VERTEX_ARRAY);
     glEnableClientState(GL_COLOR_ARRAY);
     glPushMatrix();
     glVertexPointer(3, GL_SHORT, 0, Vertices1);
     glColorPointer(3, GL_SHORT, 0, ColorData1);
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     glPopMatrix();
     glPushMatrix();
     glTranslatef(0.0,0.0,-1.4);
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
     glPopMatrix();
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_COLOR_ARRAY);
     glPolygonMode(GL_FRONT,GL_FILL);
     glDepthMask (GL_TRUE);
     glEnable(GL_CULL_FACE);
     glEnable(GL_TEXTURE_2D);
   glEndList();
}
开发者ID:Xiaobin0860,项目名称:foobillardplus,代码行数:47,代码来源:mesh.c

示例8: DrawMesh

void CollisionMesh::DrawMesh(const Matrix& projection, const Matrix& view)
{
    D3DXVECTOR3 color = m_colour;
    if(m_partition)
    {
        color = m_engine->diagnostic()->GetColor(m_partition->GetColor());
    }
    DrawMesh(projection, view, color);
}
开发者ID:huaminglee,项目名称:cloth-simulator,代码行数:9,代码来源:collisionmesh.cpp

示例9: fabs

//this function takes the index position of a cover, the linear interpolation too the next position and the index of the 
//texture it is displaying. The matrices and texture load are applied and then draw mesh is called to draw an individual cover.
void OGLES2Coverflow::DrawInPosition(int index, float queueLerp, int coverIndex)
{
	PVRTVec3 pos, posNext;
	float angle = 0.f;
	float backgroundPosition = -8.f;
	float backgroundAngle = (PVRT_PI/2.5);
	float distInQueue = 3.f;

	queueLerp += (float)index;
	coverIndex += index;

	if(coverIndex >= g_i32CoverNo)
	{
		coverIndex = coverIndex - g_i32CoverNo;
	}
	if(coverIndex < 0)
	{
		coverIndex = g_i32CoverNo;
	}

	pos = 0.f;

	pos.x = (queueLerp - eFront) * distInQueue;

	if(queueLerp > eFront - 1 && queueLerp < eFront + 1)
	{
		float lerpAbs = (float) fabs(queueLerp - eFront);
		pos.z = backgroundPosition * lerpAbs;
		angle = backgroundAngle * (queueLerp - eFront);
		pos.x += 2.0f * (queueLerp - eFront);
	}
	else
	{
		queueLerp - eFront < 0 ? angle = -backgroundAngle : angle = backgroundAngle;
		pos.z = backgroundPosition;
		if(queueLerp - eFront > 0)
			pos.x += 2.0;
		else
			pos.x -= 2.0;
	}

	PVRTMat4 mTrans, mRotation;
	PVRTMatrixTranslation(mTrans, pos.x, pos.y, pos.z);

	PVRTMatrixRotationY(mRotation, angle);
	
	PVRTMat4 mModelView, mMVP;
	mModelView = m_mView * mTrans * mRotation;
	mMVP = m_mProjection * mModelView;

	glUniformMatrix4fv(m_ShaderProgram.uiMVPMatrixLoc, 1, GL_FALSE, mMVP.f);
		
	glBindTexture(GL_TEXTURE_2D, g_Covers[coverIndex].ui32TexID);

	DrawMesh();
}
开发者ID:JLIGames,项目名称:GameThirdPartyLibs,代码行数:58,代码来源:OGLES2Coverflow.cpp

示例10: glUniform3fv

// ---------------------------------------------------------------
void MyPVRDemo::RenderStatue(const PVRTMat4& mxModel, const PVRTMat4& mxCam, const PVRTVec3& vLightPos, const StatueShader* pShader)
	{
	PVRTMat4 mxModelView = mxCam * mxModel;
	PVRTMat4 mxMVP = m_mxProjection * mxModelView;
	PVRTVec3 vLightPosModel = vLightPos;		// Light position in World space
	glUniform3fv(pShader->uiLightPos, 1, vLightPosModel.ptr());
	glUniformMatrix4fv(pShader->uiMVP, 1, GL_FALSE, mxMVP.ptr());
	glUniformMatrix4fv(pShader->uiModelView, 1, GL_FALSE, mxModelView.ptr());
	DrawMesh(enumMODEL_Statue, FLAG_VRT | FLAG_TEX0 | FLAG_NRM | FLAG_TAN);
	}
开发者ID:arron-h,项目名称:hebe-pvr-demo,代码行数:11,代码来源:MyPVRDemo.cpp

示例11: fabs

//this funciton takes the index position of a cover, the linear interpolation too the next position and the index of the
//texture it is displaying. The matrices and texture load are applied and then draw mesh is called to draw an individual cover.
void OGLESCoverflow::DrawInPosition(int index, float queueLerp, int coverIndex)
{
	PVRTVec3 pos, posNext;
	float angle = 0.0f;
	float backgroundPosition = -8.0f;
	float backgroundAngle = (PVRT_PIf/2.5f);
	float distInQueue = 3.0f;

	queueLerp += (float)index;
	coverIndex += index;

	if(coverIndex >= g_i32CoverNo)
	{
		coverIndex = coverIndex - g_i32CoverNo;
	}
	if(coverIndex < 0)
	{
		coverIndex = g_i32CoverNo;
	}

	pos = 0.0f;

	pos.x = (queueLerp - eFront) * distInQueue;

	if(queueLerp > eFront - 1 && queueLerp < eFront + 1)
	{
		float lerpAbs = (float) fabs(queueLerp - eFront);
		pos.z = backgroundPosition * lerpAbs;
		angle = backgroundAngle * (queueLerp - eFront);
		pos.x += 2.0f * (queueLerp - eFront);
	}
	else
	{
		queueLerp - eFront < 0 ? angle = -backgroundAngle : angle = backgroundAngle;
		pos.z = backgroundPosition;
		if(queueLerp - eFront > 0)
			pos.x += 2.0f;
		else
			pos.x -= 2.0f;
	}

	PVRTMat4 mTrans, mRotation;
	PVRTMatrixTranslation(mTrans, pos.x, pos.y, pos.z);

	PVRTMatrixRotationY(mRotation, angle);

	glLoadMatrixf((mTrans * m_mView * mRotation).f);

	glClientActiveTexture(GL_TEXTURE0);
	glActiveTexture(GL_TEXTURE0);

	glBindTexture(GL_TEXTURE_2D, g_Covers[coverIndex].ui32TexID);

	DrawMesh();
}
开发者ID:klokik,项目名称:Examples,代码行数:57,代码来源:OGLESCoverflow.cpp

示例12: DrawAnimationMesh

void DDModel::RenderItSelf()
{
	if ( m_IncludeAnimation )
	{
		DrawAnimationMesh();
	}
	else
	{
		DrawMesh();
	}
}
开发者ID:NHNNEXT,项目名称:2014-01-HUDIGAME-skyLab,代码行数:11,代码来源:DDModel.cpp

示例13: SetMaterial

/*!****************************************************************************
 @Function		DrawEnvironment
 @Description	Draws the environment, land, bridge etc.
******************************************************************************/
void OGLESFur::DrawEnvironment()
{
	PVRTMat4 mWorld;

	// Draw land
	SetMaterial(&c_pMaterial[3], m_aTexIDs[eTexGrass]);
	DrawMesh(eLand);

	// Draw bridge
	// Use the material from before but use a different texture
	SetMaterial(0, m_aTexIDs[eTexBridge]);
	DrawMesh(eBridge);

	// Draw Ground
	if(m_i32WaterPlaneNo)
	{
		glVertexPointer(3, GL_FLOAT, sizeof(SVertex), &m_pvPlaneWater->x);
		glNormalPointer(GL_FLOAT, sizeof(SVertex), &m_pvPlaneWater->nx);
		glTexCoordPointer(2, GL_FLOAT, sizeof(SVertex), &m_pvPlaneWater->tu);

		SetMaterial(0, m_aTexIDs[eTexWater]);

		// Draw primitive
		glDrawArrays(GL_TRIANGLE_FAN, 0, m_i32WaterPlaneNo);
	}

	// Draw Cloud
	if(m_i32CloudPlaneNo)
	{
		glVertexPointer(3, GL_FLOAT, sizeof(SVertex), &m_pvPlaneCloud->x);
		glNormalPointer(GL_FLOAT, sizeof(SVertex), &m_pvPlaneCloud->nx);
		glTexCoordPointer(2, GL_FLOAT, sizeof(SVertex), &m_pvPlaneCloud->tu);

		SetMaterial(0, m_aTexIDs[eTexCloud]);

		// Draw primitive
		glEnable(GL_BLEND);
		glDrawArrays(GL_TRIANGLE_FAN, 0, m_i32CloudPlaneNo);
		glDisable(GL_BLEND);
	}
}
开发者ID:deepbansal15,项目名称:Native_SDK,代码行数:45,代码来源:OGLESFur.cpp

示例14: glTranslatef

void CRenderer::ProcessNode(CNode* node)
{
	std::vector<CNode*> *vec = node->GetNodeVector();

	//Обновляем нод, рендерим сущности
	//Log("Node is updated\n");
	glTranslatef(node->GetPosX(), node->GetPosY(), node->GetPosZ());

	for(int i = 0; i < node->GetObjVector()->size(); i++)
	{
		if(node->GetObjVector()->at(i)->GetType()==OBJECT_ENTITY)
		{
			//TO DO:
			//Берем шейдер, соотвутствующий сущности и активируем его
			//-----
			CMaterial* mat;
			CShader* sh;
			if((mat = ((CEntity*)node->GetObjVector()->at(i))->GetMaterial())!=0)
			{
				if((sh = mat->GetShader())!=0)
				{
					if(sh->IsCompiled())
					{
						glUseProgram(sh->GetProgramId());
					}
				}
			}
			DrawMesh(((CEntity*)node->GetObjVector()->at(i))->GetMesh());
			glUseProgram(0);
		}
	}
	
	glDisable(GL_DEPTH_TEST);
	glBegin(GL_LINES);
	glColor3f(0.5, 1, 0.5);
	glVertex3f(0, 0, 0);
	glVertex3f(0, 1, 0);
	glColor3f(1, 0.5, 0.5);
	glVertex3f(0, 0, 0);
	glVertex3f(1, 0, 0);
	glColor3f(0.5, 0.5, 1);
	glVertex3f(0, 0, 0);
	glVertex3f(0, 0, 1);
	glColor3f(1,1,1);
	glEnd();
	glEnable(GL_DEPTH_TEST);

	for(int i = 0; i < vec->size(); i++)
	{
		ProcessNode(vec->at(i));	
	}
	glTranslatef(-node->GetPosX(), -node->GetPosY(), -node->GetPosZ());
}
开发者ID:SleepWalk2,项目名称:GLue_memento,代码行数:53,代码来源:renderer.cpp

示例15: TRACE_FUN

void CMeter2DGraphView::paintGL()
{
   TRACE_FUN( Frequently, "CMeter2DGraphView::paintGL" );
   
   CAbstractMeterView::paintGL();

   if( model()->hasValues() )
   {
      DrawTitles();
      DrawMesh();
      DrawValueGraph();
   }
}
开发者ID:L2-Max,项目名称:l2ChipTuner,代码行数:13,代码来源:Meter2DGraphView.cpp


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