当前位置: 首页>>代码示例>>C++>>正文


C++ ObjModel::LoadOBJ方法代码示例

本文整理汇总了C++中ObjModel::LoadOBJ方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjModel::LoadOBJ方法的具体用法?C++ ObjModel::LoadOBJ怎么用?C++ ObjModel::LoadOBJ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjModel的用法示例。


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

示例1: InitializeApp

bool InitializeApp()
{
  glClearColor(0, 0, 0, 1);
  glShadeModel(GL_SMOOTH);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_TEXTURE_2D);

  // Load texture.
  int width = 0, height = 0, comp = 0;
  unsigned char *image;
  image = LoadTGA("/home/aashish/tools/mywork/src.git/data/noise.tga", width, height, comp);

  glGenTextures(1, &_gRandomSampler);
  glBindTexture(GL_TEXTURE_2D, _gRandomSampler);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height,
               0, GL_RGB, GL_UNSIGNED_BYTE, image);

   delete[] image;

  // Load shaders.
  if(!CreateGLSLShader("/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/setRenderTargetsVs.glsl",
                      "/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/setRenderTargetsPs.glsl",
                      _gSetRenderTargetShader))
    return false;

  if(!CreateGLSLShader("/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/clearRenderTargetsVs.glsl",
                      "/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/clearRenderTargetsPs.glsl",
                      _gClearRenderTargetShader))
    return false;

  if(!CreateGLSLShader("/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/ssaoVs.glsl",
                      "/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/ssaoPs.glsl",
                      _gSsaoShader))
   return false;


  if(!CreateGLSLShader("/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/hBlurVs.glsl",
                      "/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/hBlurPs.glsl",
                      _gHorizontalBlurShader))
  return false;

  if(!CreateGLSLShader("/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/vBlurVs.glsl",
                       "/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/vBlurPs.glsl",
                       _gVerticalBlurShader))
    return false;

  if(!CreateGLSLShader("/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/renderingVs.glsl",
                       "/home/aashish/tools/mywork/src.git/opengl/ssao_crytek/renderingPs.glsl",
                        _gRenderShader))
    return false;

  // Bind our shader variables.
  _gOffset            = glGetUniformLocationARB(_gRenderShader, "offset");

  _gLight1Pos             = glGetUniformLocationARB(_gRenderShader, "light1Pos");
  _gLight1AmbientColor    = glGetUniformLocationARB(_gRenderShader, "light1AmbientColor");
  _gLight1DiffuseColor    = glGetUniformLocationARB(_gRenderShader, "light1DiffuseColor");
  _gLight1SpecularColor   = glGetUniformLocationARB(_gRenderShader, "light1SpecularColor");

  _gLight2Pos             = glGetUniformLocationARB(_gRenderShader, "light2Pos");
  _gLight2AmbientColor    = glGetUniformLocationARB(_gRenderShader, "light2AmbientColor");
  _gLight2DiffuseColor    = glGetUniformLocationARB(_gRenderShader, "light2DiffuseColor");
  _gLight2SpecularColor   = glGetUniformLocationARB(_gRenderShader, "light2SpecularColor");

  _gAmbientOcclusion  = glGetUniformLocationARB(_gRenderShader, "aos");
  _gSceneColors       = glGetUniformLocationARB(_gRenderShader, "colors");
  _gSceneDepths       = glGetUniformLocationARB(_gRenderShader, "depths");
  _gSceneNormals      = glGetUniformLocationARB(_gRenderShader, "normals");

  _gSsaoOffset        = glGetUniformLocationARB(_gSsaoShader, "offset");
  _gSsaoNormals       = glGetUniformLocationARB(_gSsaoShader, "normals");
  _gSsaoDepths        = glGetUniformLocationARB(_gSsaoShader, "depths");
  _gSsaoRandoms       = glGetUniformLocationARB(_gSsaoShader, "randoms");

  _gHorizontalBlurSceneSampler       = glGetUniformLocationARB(_gHorizontalBlurShader, "scene");
  _gHorizontalBlurSceneSamplerDepth  = glGetUniformLocationARB(_gHorizontalBlurShader, "depths");
  _gHorizontalBlurSceneSamplerNormal = glGetUniformLocationARB(_gHorizontalBlurShader, "normals");

  _gVerticalBlurSceneSampler       = glGetUniformLocationARB(_gVerticalBlurShader, "scene");
  _gVerticalBlurSceneDepthSampler  = glGetUniformLocationARB(_gVerticalBlurShader, "depths");
  _gVerticalBlurSceneNormalSampler = glGetUniformLocationARB(_gVerticalBlurShader, "normals");

  // Create frame buffer objects.
  if(_gSceneFbo.Create(WIDTH, HEIGHT) == false)
    return false;

  // Create frame buffer objects.
  if(_gSsaoFbo.Create(WIDTH, HEIGHT) == false)
    return false;

  // Create frame buffer objects.
  if(_gHorizontalBlurFbo.Create(WIDTH, HEIGHT) == false)
    return false;

  if(_gVerticalBlurFbo.Create(WIDTH, HEIGHT) == false)
    return false;

  if(_gModel.LoadOBJ("/home/aashish/tools/mywork/src.git/data/sponza.obj") == false)
//.........这里部分代码省略.........
开发者ID:aashish24,项目名称:myexp,代码行数:101,代码来源:main.cpp


注:本文中的ObjModel::LoadOBJ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。