|
@ -13,10 +13,13 @@ FullScreenQuad *fsq; |
|
|
void Init() |
|
|
void Init() |
|
|
{ |
|
|
{ |
|
|
model.Init("Res/Sphere.obj"); |
|
|
model.Init("Res/Sphere.obj"); |
|
|
model.mShader->Init("Res/ambient_vs.vs", "Res/ambient_vs.fs"); |
|
|
|
|
|
|
|
|
model.mShader->Init("Res/diffuse_vs.vs", "Res/diffuse_vs.fs"); |
|
|
model.SetPosition(0.0f, 0.0f, 0.0f); |
|
|
model.SetPosition(0.0f, 0.0f, 0.0f); |
|
|
model.SetAmbientMaterial(0.1f, 0.1f, 0.1f, 1.0f); |
|
|
model.SetAmbientMaterial(0.1f, 0.1f, 0.1f, 1.0f); |
|
|
model.mShader->SetVec4("U_AmbientLight", 0.1f, 0.1f, 0.1f, 1.0f); |
|
|
model.mShader->SetVec4("U_AmbientLight", 0.1f, 0.1f, 0.1f, 1.0f); |
|
|
|
|
|
model.SetDiffuseMaterial(0.4f, 0.4f, 0.4f, 1.0f); |
|
|
|
|
|
model.mShader->SetVec4("U_DiffuseLight", 0.8f, 0.8f, 0.8f, 1.0f); |
|
|
|
|
|
model.mShader->SetVec4("U_LightPos", 0.0f, 1.0f, 0.0f, 0.0f); |
|
|
viewMatrix = glm::lookAt(cameraPos, glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); |
|
|
viewMatrix = glm::lookAt(cameraPos, glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); |
|
|
fsq = new FullScreenQuad(); |
|
|
fsq = new FullScreenQuad(); |
|
|
fsq->Init(); |
|
|
fsq->Init(); |
|
@ -32,6 +35,8 @@ void SetViewPortSize(float width, float height) |
|
|
fbo->Finish(); |
|
|
fbo->Finish(); |
|
|
|
|
|
|
|
|
fbo->Bind(); |
|
|
fbo->Bind(); |
|
|
|
|
|
glClearColor(0.1f, 0.1f, 0.1f, 1.0f); |
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
model.Draw(viewMatrix, projectionMatrix, cameraPos.x, cameraPos.y, cameraPos.z); |
|
|
model.Draw(viewMatrix, projectionMatrix, cameraPos.x, cameraPos.y, cameraPos.z); |
|
|
fbo->Unbind(); |
|
|
fbo->Unbind(); |
|
|
} |
|
|
} |
|
|