コード例 #1
0
void
J3DSurface::PlaceVertex
	(
	J3DPainter&		p,
	const JIndex	rowIndex
	)
{
	const JFloat vertex[3] =
		{
		itsVertexList->GetElement(rowIndex, 1),
		itsVertexList->GetElement(rowIndex, 2),
		itsVertexList->GetElement(rowIndex, 3)
		};

	JRGB color;
	JFloat alpha = (vertex[2] - itsZMin)/(itsZMax - itsZMin);
	if (alpha <= 0.5)
		{
		color = JBlend(itsMinColor, itsMidColor, 2.0*alpha);
		}
	else
		{
		color = JBlend(itsMidColor, itsMaxColor, 2.0*alpha - 1.0);
		}
	const JColorIndex colorIndex = (p.GetColormap()).GetColor(color);
	p.SetVertexColor(colorIndex);

	glVertex3dv(vertex);
}
コード例 #2
0
void
J3DCylinder::Render
	(
	J3DPainter& p
	)
{
	p.SetVertexColor(itsColor);

	gluCylinder(itsQuadric, itsBaseRadius, itsTopRadius, itsHeight,
				32,		// 32 faces
				1);		// ???
}
コード例 #3
0
void
J3DTriangle::Render
(
    J3DPainter& p
)
{
    glBegin(GL_TRIANGLES);

    for (JIndex i=0; i<3; i++)
    {
        p.SetVertexColor(itsVertexColor[i]);
        glVertex3dv(itsVertex[i]->GetElements());
    }

    glEnd();
}