本文整理汇总了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 );
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例12: DrawAnimationMesh
void DDModel::RenderItSelf()
{
if ( m_IncludeAnimation )
{
DrawAnimationMesh();
}
else
{
DrawMesh();
}
}
示例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);
}
}
示例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());
}
示例15: TRACE_FUN
void CMeter2DGraphView::paintGL()
{
TRACE_FUN( Frequently, "CMeter2DGraphView::paintGL" );
CAbstractMeterView::paintGL();
if( model()->hasValues() )
{
DrawTitles();
DrawMesh();
DrawValueGraph();
}
}