本文整理汇总了C++中GLContext::getVertexProcessor方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::getVertexProcessor方法的具体用法?C++ GLContext::getVertexProcessor怎么用?C++ GLContext::getVertexProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLContext
的用法示例。
在下文中一共展示了GLContext::getVertexProcessor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderGalaxyEllipsoid
void Galaxy::renderGalaxyEllipsoid(const GLContext& context,
const Vec3f& offset,
const Quatf&,
float,
float pixelSize)
{
float discSizeInPixels = pixelSize * getRadius() / offset.length();
unsigned int nRings = (unsigned int) (discSizeInPixels / 4.0f);
unsigned int nSlices = (unsigned int) (discSizeInPixels / 4.0f);
nRings = max(nRings, 100u);
nSlices = max(nSlices, 100u);
VertexProcessor* vproc = context.getVertexProcessor();
if (vproc == NULL)
return;
//int e = min(max((int) type - (int) E0, 0), 7);
Vec3f scale = Vec3f(1.0f, 0.9f, 1.0f) * getRadius();
Vec3f eyePos_obj = -offset * (~getOrientation()).toMatrix3();
vproc->enable();
vproc->use(vp::ellipticalGalaxy);
vproc->parameter(vp::EyePosition, eyePos_obj);
vproc->parameter(vp::Scale, scale);
vproc->parameter(vp::InverseScale,
Vec3f(1.0f / scale.x, 1.0f / scale.y, 1.0f / scale.z));
vproc->parameter((vp::Parameter) 23, eyePos_obj.length() / scale.x, 0.0f, 0.0f, 0.0f);
glRotate(getOrientation());
glDisable(GL_TEXTURE_2D);
glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
for (unsigned int i = 0; i < nRings; i++)
{
float phi0 = (float) PI * ((float) i / (float) nRings - 0.5f);
float phi1 = (float) PI * ((float) (i + 1) / (float) nRings - 0.5f);
glBegin(GL_QUAD_STRIP);
for (unsigned int j = 0; j <= nSlices; j++)
{
float theta = (float) (PI * 2) * (float) j / (float) nSlices;
float sinTheta = (float) sin(theta);
float cosTheta = (float) cos(theta);
glVertex3f((float) cos(phi0) * cosTheta * scale.x,
(float) sin(phi0) * scale.y,
(float) cos(phi0) * sinTheta * scale.z);
glVertex3f((float) cos(phi1) * cosTheta * scale.x,
(float) sin(phi1) * scale.y,
(float) cos(phi1) * sinTheta * scale.z);
}
glEnd();
}
glEnable(GL_TEXTURE_2D);
vproc->disable();
}