您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DrawTriangle函数代码示例

51自学网 2021-06-01 20:30:18
  C++
这篇教程C++ DrawTriangle函数代码示例写得很实用,希望能帮到您。

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

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

示例1: DrawTriangle

void PolygonShapeBuilder::DrawRectangle(    const Vector2& position,    float width,    float height,    const Vector2& originPivot,    const Color& color){    if (width <= 0 || height <= 0) {        return;    }    Vector2 anchorOffset = Vector2{width, height} * originPivot;    const auto minX = position.X - anchorOffset.X;    const auto minY = position.Y - anchorOffset.Y;    const auto maxX = position.X + width - anchorOffset.X;    const auto maxY = position.Y + height - anchorOffset.Y;    std::array<Vector3, 4> rectVertices = {{        Vector3{minX, minY, 0.0f},        Vector3{minX, maxY, 0.0f},        Vector3{maxX, maxY, 0.0f},        Vector3{maxX, minY, 0.0f},    }};    auto colorVector = color.ToVector4();    DrawTriangle(        rectVertices[0], rectVertices[1], rectVertices[2],        colorVector, colorVector, colorVector);    DrawTriangle(        rectVertices[2], rectVertices[3], rectVertices[0],        colorVector, colorVector, colorVector);}
开发者ID:mogemimi,项目名称:pomdog,代码行数:33,


示例2: DrawRectangle

// DrawQuads (GL_QUADS)void nuiSoftwarePainter::DrawQuadStrip(const nuiRenderArray* pArray){  int32 i;  int32 count = (pArray->GetSize() - 2) / 2;  for (i = 0; i < count; i++)  {    int32 ii = i << 1;    // Is the quad a special case?    const std::vector<nuiRenderArray::Vertex>& rCoords = pArray->GetVertices();    float x0 = rCoords[ii].mX, y0 = rCoords[ii+1].mY;    float x1 = rCoords[(ii+1)].mX, y1 = rCoords[(ii+1)].mY;    float x2 = rCoords[(ii+2)].mX, y2 = rCoords[(ii+2)].mY;    float x3 = rCoords[(ii+3)].mX, y3 = rCoords[(ii+3)].mY;    if (x0 == x3 && x1 == x2 && y0 == y1 && y2 == y3)    {      // This is an axis aligned rectangle      DrawRectangle(pArray, ii, ii+1, ii+3, ii+2);    }    else    {      // This is not a special quad, draw two triangles:      DrawTriangle(pArray, ii, ii+1, ii+2);      DrawTriangle(pArray, ii+1, ii+3, ii+2);    }  }}
开发者ID:jbl2024,项目名称:nui3,代码行数:29,


示例3: submitMesh

    void KGEDevice::SoftRasterization(HDC hdc)    {        submitMesh();        transformVertexes();        /// TODO        /// for test hard code        DrawPoint(hdc, 100, 100, Vector4(1, 0, 0, 1));        DrawLine(hdc, 200, 247, 300, 405, Vector4(1, 0, 0, 1));        DrawTriangle(hdc, 500, 200, 400, 300, 700, 400, Vector4(0, 1, 0, 1));        int nIDtri = (int)_transformMesh->triList.size();        for (int i = 0; i<nIDtri; i++){            const KGETriangle & IDtri = _transformMesh->triList[i];            const int vID0 = IDtri.vID(0);            const int vID1 = IDtri.vID(1);            const int vID2 = IDtri.vID(2);            if (vID0 == -1)continue;            KGEVertex v0, v1, v2;            v0 = _transformMesh->GetVertex(vID0);            v1 = _transformMesh->GetVertex(vID1);            v2 = _transformMesh->GetVertex(vID2);            DrawTriangle(hdc, v0.pos.x, v0.pos.y, v1.pos.x, v1.pos.y, v2.pos.x, v2.pos.y, v0.color);        }        /// end test hard code    }
开发者ID:iamkevinf,项目名称:KGESR,代码行数:26,


示例4: DrawTriangleFan

static void DrawTriangleFan(State * state, GLuint index) {	SelectArrayElement(state, index, state->vertexQueue + state->nextIndex);	if (state->primitiveState == 3) {		// even triangle		GLuint prevIndex = (state->nextIndex - 1) > state->nextIndex ? state->nextIndex + 2 : state->nextIndex - 1;		GLuint prevIndex2 = (state->nextIndex - 2) > state->nextIndex ? state->nextIndex + 1 : state->nextIndex - 2;		DrawTriangle(state, state->vertexQueue + prevIndex, state->vertexQueue + prevIndex2, 				     state->vertexQueue + state->nextIndex);		state->primitiveState = 2;	} else if (state->primitiveState == 2) {		// odd triangle		GLuint prevIndex = (state->nextIndex - 1) > state->nextIndex ? state->nextIndex + 2 : state->nextIndex - 1;		GLuint prevIndex2 = (state->nextIndex - 2) > state->nextIndex ? state->nextIndex + 1 : state->nextIndex - 2;		DrawTriangle(state, state->vertexQueue + prevIndex2, state->vertexQueue + prevIndex, 					 state->vertexQueue + state->nextIndex);		state->primitiveState = 3;	} else if (state->primitiveState == 1) {		// remember seen second vertex		state->primitiveState = 2;	} else if (state->primitiveState == 0) {		// remember seen first vertex		state->primitiveState = 1;	}	if (++state->nextIndex == 3) {		state->nextIndex = 1;	}}
开发者ID:mew-cx,项目名称:Vincent_ES_2.x,代码行数:29,


示例5: p9

void p9(void) {	SetDrawScreen(DX_SCREEN_BACK);	char keybuf[256];	while (ProcessMessage() == 0 && GetHitKeyStateAll(keybuf) == 0 && keybuf[KEY_INPUT_ESCAPE] == 0) {		ClearDrawScreen();		DrawLine(10, 10, 200, 10, GetColor(255, 0, 0));		DrawLine(10, 20, 200, 20, GetColor(0, 255, 0));		DrawLine(10, 30, 200, 30, GetColor(0, 0, 255));		SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100);	//	αブレンド		DrawBox(5, 5, 205, 35, GetColor(255, 255, 255), TRUE);		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, TRUE);	//	ブレンドなし		DrawBox(100, 100, 201, 201, GetColor(255, 0, 0), TRUE);		SetDrawBlendMode(DX_BLENDMODE_ADD, 255);	//	加算ブレンド		DrawCircle(150, 150, 50, GetColor(0, 255, 255), TRUE);		SetDrawBlendMode(DX_BLENDMODE_SUB, 255);	//	
C++ Draw_Pic函数代码示例
C++ DrawThemeBackground函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。