本文整理汇总了C++中GLRenderer::enableRenderingHint方法的典型用法代码示例。如果您正苦于以下问题:C++ GLRenderer::enableRenderingHint方法的具体用法?C++ GLRenderer::enableRenderingHint怎么用?C++ GLRenderer::enableRenderingHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLRenderer
的用法示例。
在下文中一共展示了GLRenderer::enableRenderingHint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// Main function
int main(int argc, char *argv[])
{
#if defined(DEBUG) | defined(_DEBUG)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
return 0;
// random seed
randomSeed = static_cast<unsigned int>(time(NULL));
// Sets the update step
System::setClampStep(true,0.1f); // clamp the step to 100 ms
System::useAdaptiveStep(0.001f,0.01f); // use an adaptive step from 1ms to 10ms (1000fps to 100fps)
SDL_Event event;
// inits SDL
SDL_Init(SDL_INIT_VIDEO);
//SDL_WM_SetCaption("SPARK Basic Demo",NULL);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1); // double buffering
// vsync
//+SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL,0);
//+SDL_SetVideoMode(0,0,32, SDL_OPENGL | SDL_FULLSCREEN);
SDL_ShowCursor(0);
//+SDL_Surface screen = *SDL_GetVideoSurface();
screenWidth = 640;
screenHeight = 480;
SDL_Window* window = SDL_CreateWindow("OpenGL Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screenWidth, screenHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
renderFirstFrame();
// inits openGL
screenRatio = (float)screenWidth / (float)screenHeight;
glClearColor(0.0f,0.0f,0.0f,1.0f);
glViewport(0,0,screenWidth,screenHeight);
// Loads texture font
FTGLTextureFont font = FTGLTextureFont("res/font.ttf");
if(font.Error())
return 1;
font.FaceSize(24);
fontPtr = &font;
// Loads particle texture
GLuint textureParticle;
if (!loadTexture(textureParticle,"res/point.bmp",GL_ALPHA,/*GL_CLAMP*/GL_CLAMP_TO_EDGE,false))
return 1;
// Inits Particle Engine
Vector3D gravity(0.0f,-0.8f,0.0f);
// Renderers
GLPointRenderer* basicRenderer = GLPointRenderer::create();
GLRenderer* particleRenderer = NULL;
// We use pointSprites only if it is available and if the GL extension point parameter is available
if ((GLPointRenderer::loadGLExtPointSprite())&&(GLPointRenderer::loadGLExtPointParameter()))
{
GLPointRenderer* pointRenderer = GLPointRenderer::create();
pointRenderer->setType(POINT_SPRITE);
pointRenderer->setTexture(textureParticle);
pointRenderer->setTextureBlending(GL_MODULATE);
pointRenderer->enableWorldSize(true);
GLPointRenderer::setPixelPerUnit(45.0f * PI / 180.f,screenHeight);
pointRenderer->setSize(0.05f);
particleRenderer = pointRenderer;
}
else // we use quads
{
GLQuadRenderer* quadRenderer = GLQuadRenderer::create();
quadRenderer->setTexturingMode(TEXTURE_2D);
quadRenderer->setTexture(textureParticle);
quadRenderer->setTextureBlending(GL_MODULATE);
quadRenderer->setScale(0.05f,0.05f);
particleRenderer = quadRenderer;
}
particleRenderer->setBlending(BLENDING_ADD);
particleRenderer->enableRenderingHint(DEPTH_WRITE,false);
// Model
Model* particleModel = Model::create(FLAG_RED | FLAG_GREEN | FLAG_BLUE | FLAG_ALPHA);
particleModel->setParam(PARAM_ALPHA,0.8f); // constant alpha
particleModel->setLifeTime(8.0f,8.0f);
// Emitter
SphericEmitter* particleEmitter = SphericEmitter::create(Vector3D(0.0f,1.0f,0.0f),0.1f * PI,0.1f * PI);
particleEmitter->setZone(Point::create(Vector3D(0.0f,0.015f,0.0f)));
particleEmitter->setFlow(250);
particleEmitter->setForce(1.5f,1.5f);
// Obstacle
Plane* groundPlane = Plane::create();
Obstacle* obstacle = Obstacle::create(groundPlane,INTERSECT_ZONE,0.6f,1.0f);
// Group
//.........这里部分代码省略.........