=== modified file 'main.cpp'
@@ -9,7 +9,7 @@
int running = 1;
unsigned current_scene = 0;
Screen screen;
-
+
printf("===================================================\n");
printf(" GLMark 08\n");
printf("===================================================\n");
@@ -71,14 +71,14 @@
running = false;
}
-
+
screen.update();
}
-
+
unsigned score = 0;
for (unsigned i = 0; i < num_scenes; i++)
score += scene[i]->calculate_score();
-
+
printf("===================================================\n");
printf("Your GLMark08 Score is %u ^_^\n", score);
printf("===================================================\n");
=== modified file 'scene.h'
@@ -21,10 +21,10 @@
virtual void start();
virtual void update();
virtual void draw();
-
+
unsigned calculate_score();
bool is_running();
-
+
protected:
unsigned mPartsQty; // How many parts for the scene
unsigned mCurrentPart; // The current part being rendered
@@ -33,7 +33,7 @@
double mLastTime, mCurrentTime, mDt;
unsigned mCurrentFrame;
bool mRunning;
-
+
unsigned *mAverageFPS; // Average FPS per part
float *mScoreScale;
@@ -52,7 +52,7 @@
void start();
void update();
void draw();
-
+
~SceneBuild();
protected:
@@ -72,9 +72,9 @@
void start();
void update();
void draw();
-
+
~SceneTexture();
-
+
protected:
Shader mShader;
@@ -93,9 +93,9 @@
void start();
void update();
void draw();
-
+
~SceneShading();
-
+
protected:
Shader mShader[2];
=== modified file 'scenetexture.cpp'
@@ -10,41 +10,41 @@
int SceneTexture::load()
{
Model model;
-
+
if(!model.load_3ds(GLMARK_DATA_PATH"data/models/cube.3ds"))
return 0;
-
+
if(!load_texture(GLMARK_DATA_PATH"data/textures/crate-base.bmp", mTexture))
return 0;
-
+
model.calculate_normals();
model.convert_to_mesh(&mCubeMesh);
mCubeMesh.build_vbo();
mShader.load(GLMARK_DATA_PATH"data/shaders/light-basic.vert",
GLMARK_DATA_PATH"data/shaders/light-basic-tex.frag");
-
+
mRotationSpeed = Vector3f(36.0f, 36.0f, 36.0f);
-
+
mRunning = false;
-
+
mPartsQty = 3;
mPartDuration = new double[mPartsQty];
mAverageFPS = new unsigned[mPartsQty];
mScoreScale = new float[mPartsQty];
-
+
mScoreScale[0] = 0.471f;
mScoreScale[1] = 0.533f;
mScoreScale[2] = 0.405f;
-
+
mPartDuration[0] = 10.0;
mPartDuration[1] = 10.0;
mPartDuration[2] = 10.0;
-
+
memset(mAverageFPS, 0, mPartsQty * sizeof(*mAverageFPS));
mCurrentPart = 0;
-
+
return 1;
}
@@ -60,7 +60,7 @@
GLfloat lightDiffuse[] = {0.8f, 0.8f, 0.8f, 1.0f};
GLfloat lightPosition[] = {20.0f, 20.0f, 10.0f, 1.0f};
GLfloat materialColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
-
+
mShader.use();
// Load lighting and material uniforms
@@ -82,25 +82,24 @@
mCurrentTime = SDL_GetTicks() / 1000.0;
mDt = mCurrentTime - mLastTime;
mLastTime = mCurrentTime;
-
+
mElapsedTime = mCurrentTime - mStartTime;
-
+
if(mElapsedTime >= mPartDuration[mCurrentPart])
{
mAverageFPS[mCurrentPart] = mCurrentFrame / mElapsedTime;
-
- switch(mCurrentPart)
- {
- case 0:
- printf("Texture filtering\n");
- printf(" Nearest FPS: %u\n", mAverageFPS[mCurrentPart]);
- break;
- case 1:
- printf(" Linear FPS: %u\n", mAverageFPS[mCurrentPart]);
- break;
- case 2:
- printf(" Mipmapped FPS: %u\n", mAverageFPS[mCurrentPart]);
- break;
+
+ switch(mCurrentPart) {
+ case 0:
+ printf("Texture filtering\n");
+ printf(" Nearest FPS: %u\n", mAverageFPS[mCurrentPart]);
+ break;
+ case 1:
+ printf(" Linear FPS: %u\n", mAverageFPS[mCurrentPart]);
+ break;
+ case 2:
+ printf(" Mipmapped FPS: %u\n", mAverageFPS[mCurrentPart]);
+ break;
}
mCurrentPart++;
if(mCurrentPart >= mPartsQty)
@@ -108,9 +107,9 @@
else
start();
}
-
+
mRotation += mRotationSpeed * mDt;
-
+
mCurrentFrame++;
}
=== modified file 'screen.cpp'
@@ -38,7 +38,7 @@
}
if(mFullScreen)
- mFlags = SDL_OPENGL | SDL_FULLSCREEN;
+ mFlags = SDL_OPENGL | SDL_FULLSCREEN;
mInfo = SDL_GetVideoInfo();
=== modified file 'texture.cpp'
@@ -36,22 +36,22 @@
// Create Nearest Filtered Texture
glBindTexture(GL_TEXTURE_2D, pTexture[0]);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
texture_format, GL_UNSIGNED_BYTE, surface->pixels);
// Create Linear Filtered Texture
glBindTexture(GL_TEXTURE_2D, pTexture[1]);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
texture_format, GL_UNSIGNED_BYTE, surface->pixels);
// Create trilinear filtered mipmapped texture
glBindTexture(GL_TEXTURE_2D, pTexture[2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, surface->w, surface->h, 0,
texture_format, GL_UNSIGNED_BYTE, surface->pixels);
glGenerateMipmap(GL_TEXTURE_2D);