update tutorial for SIGGRAPH course
allow multiple graphing windows at the same time
This commit is contained in:
@@ -1297,7 +1297,7 @@ void GLInstancingRenderer::renderSceneInternal(int renderMode)
|
||||
//glDepthFunc(GL_LESS);
|
||||
|
||||
// Cull triangles which normal is not towards the camera
|
||||
//glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
virtual void swapBuffer();
|
||||
virtual void drawText( const char* txt, int posX, int posY);
|
||||
virtual void setBackgroundColor(float red, float green, float blue);
|
||||
virtual int registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ, int textureIndex = -1)
|
||||
virtual int registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ, int textureIndex = -1, float textureScaling = 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -421,27 +421,27 @@ struct GfxVertex
|
||||
float u,v;
|
||||
};
|
||||
|
||||
int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ, int textureIndex)
|
||||
int SimpleOpenGL3App::registerCubeShape(float halfExtentsX,float halfExtentsY, float halfExtentsZ, int textureIndex, float textureScaling)
|
||||
{
|
||||
|
||||
|
||||
int strideInBytes = 9*sizeof(float);
|
||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||
int numVertices = sizeof(cube_vertices_textured)/strideInBytes;
|
||||
int numIndices = sizeof(cube_indices)/sizeof(int);
|
||||
|
||||
b3AlignedObjectArray<GfxVertex> verts;
|
||||
verts.resize(numVertices);
|
||||
for (int i=0;i<numVertices;i++)
|
||||
{
|
||||
verts[i].x = halfExtentsX*cube_vertices[i*9];
|
||||
verts[i].y = halfExtentsY*cube_vertices[i*9+1];
|
||||
verts[i].z = halfExtentsZ*cube_vertices[i*9+2];
|
||||
verts[i].w = cube_vertices[i*9+3];
|
||||
verts[i].nx = cube_vertices[i*9+4];
|
||||
verts[i].ny = cube_vertices[i*9+5];
|
||||
verts[i].nz = cube_vertices[i*9+6];
|
||||
verts[i].u = cube_vertices[i*9+7];
|
||||
verts[i].v = cube_vertices[i*9+8];
|
||||
verts[i].x = halfExtentsX*cube_vertices_textured[i*9];
|
||||
verts[i].y = halfExtentsY*cube_vertices_textured[i*9+1];
|
||||
verts[i].z = halfExtentsZ*cube_vertices_textured[i*9+2];
|
||||
verts[i].w = cube_vertices_textured[i*9+3];
|
||||
verts[i].nx = cube_vertices_textured[i*9+4];
|
||||
verts[i].ny = cube_vertices_textured[i*9+5];
|
||||
verts[i].nz = cube_vertices_textured[i*9+6];
|
||||
verts[i].u = cube_vertices_textured[i*9+7]*textureScaling;
|
||||
verts[i].v = cube_vertices_textured[i*9+8]*textureScaling;
|
||||
}
|
||||
|
||||
int shapeId = m_instancingRenderer->registerShape(&verts[0].x,numVertices,cube_indices,numIndices,B3_GL_TRIANGLES,textureIndex);
|
||||
@@ -709,10 +709,10 @@ void SimpleOpenGL3App::swapBuffer()
|
||||
(int) m_window->getRetinaScale()*this->m_instancingRenderer->getScreenHeight(),m_data->m_frameDumpPngFileName,
|
||||
m_data->m_ffmpegFile);
|
||||
m_data->m_renderTexture->disable();
|
||||
//if (m_data->m_ffmpegFile==0)
|
||||
//{
|
||||
m_data->m_frameDumpPngFileName = 0;
|
||||
//}
|
||||
if (m_data->m_ffmpegFile==0)
|
||||
{
|
||||
m_data->m_frameDumpPngFileName = 0;
|
||||
}
|
||||
}
|
||||
m_window->startRendering();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ struct SimpleOpenGL3App : public CommonGraphicsApp
|
||||
SimpleOpenGL3App(const char* title, int width,int height, bool allowRetina);
|
||||
virtual ~SimpleOpenGL3App();
|
||||
|
||||
virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1);
|
||||
virtual int registerCubeShape(float halfExtentsX=1.f,float halfExtentsY=1.f, float halfExtentsZ = 1.f, int textureIndex = -1, float textureScaling = 1);
|
||||
virtual int registerGraphicsUnitSphereShape(EnumSphereLevelOfDetail lod, int textureId=-1);
|
||||
virtual void registerGrid(int xres, int yres, float color0[4], float color1[4]);
|
||||
void dumpNextFrameToPng(const char* pngFilename);
|
||||
|
||||
Reference in New Issue
Block a user