本文整理汇总了C++中ParticleManager::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleManager::Init方法的具体用法?C++ ParticleManager::Init怎么用?C++ ParticleManager::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleManager
的用法示例。
在下文中一共展示了ParticleManager::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
/*-----------------------------------------------------------------------------------------------
Description:
Governs window creation, the initial OpenGL configuration (face culling, depth mask, even
though this is a 2D demo and that stuff won't be of concern), the creation of geometry, and
the creation of a texture.
Parameters:
argc (From main(...)) The number of char * items in argv. For glut's initialization.
argv (From main(...)) A collection of argument strings. For glut's initialization.
Returns:
False if something went wrong during initialization, otherwise true;
Exception: Safe
Creator: John Cox (3-7-2016)
-----------------------------------------------------------------------------------------------*/
void Init()
{
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);
glDepthRange(0.0f, 1.0f);
GLuint particleProgramId = GenerateVertexShaderProgram();
GLuint computeProgramId = GenerateComputeShaderProgram();
// all values are in windows space (X and Y limited to [-1,+1])
// Note: Toy with the values as you will.
//unsigned int totalParticles = 20000;
unsigned int totalParticles = 600000;
unsigned int maxParticlesEmittedPerFrame = 200;
glm::vec2 center = glm::vec2(+0.3f, +0.3f);
float radius = 1.1f;
float minVelocity = 0.05f;
float maxVelocity = 0.6f;
gParticleManager.Init(particleProgramId,
computeProgramId,
totalParticles,
maxParticlesEmittedPerFrame,
center,
radius,
minVelocity,
maxVelocity);
}