コード例 #1
0
ファイル: TestApp.cpp プロジェクト: sukharev/phd
	virtual bool Start()
	{
		CInputTask::GetPtr()->AddInputEventListener(this);
		CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 2));
		m_nPolygonMode = GL_FILL;
		m_bHDR = true;
		m_fExposure = 1.0f;

		// ATI doesn't support rectangular textures in GLSL
		m_bHDRSquare = !CVideoTask::GetPtr()->IsNVIDIA();
		if(CVideoTask::GetPtr()->IsNVIDIA())
		{
			m_fb.Init(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight(), GL_FLOAT_RGBA16_NV);
			if(m_fb.IsValid())
				m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRRectFrag.glsl");
		}
		else if(CVideoTask::GetPtr()->IsATI())
		{
			m_fb.Init(1024, 1024, GL_RGBA_FLOAT16_ATI);
			if(m_fb.IsValid())
				m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRSquareFrag.glsl");
		}
		else
		{
			m_fb.Init(1024, 1024, GL_RGBA16F_ARB);
			if(m_fb.IsValid())
				m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRSquareFrag.glsl");
		}

		return true;
	}
コード例 #2
0
ファイル: GLCloud2.cpp プロジェクト: sukharev/phd
	virtual void Update()
	{
		PROFILE("CAppTask::Update()", 1);
		glClearColor(0.253f, 0.47f, 0.683f, 1);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		glPolygonMode(GL_FRONT, m_nPolygonMode);
		if(m_nPolygonMode == GL_FILL)
		{
			glDisable(GL_DEPTH_TEST);
			m_tex.Enable();
			m_shader.Enable();
			m_shader.SetUniformParameter1i("s3Tex0", 0);
		}

		CSRTTransform camera = CCameraTask::GetPtr()->GetCamera();
		float fDistance[2];
		fDistance[0] = camera.GetPosition().Distance(m_cSphere.GetPosition());
		fDistance[1] = camera.GetPosition().Distance(m_cSphere2.GetPosition());
		if(fDistance[0] > fDistance[1])
		{
			m_cSphere.Draw(camera, m_tex);
			m_cSphere2.Draw(camera, m_tex);
		}
		else
		{
			m_cSphere2.Draw(camera, m_tex);
			m_cSphere.Draw(camera, m_tex);
		}
		glEnable(GL_DEPTH_TEST);
		m_shader.Disable();
		m_tex.Disable();
		glPolygonMode(GL_FRONT, GL_FILL);
	}
コード例 #3
0
ファイル: main.cpp プロジェクト: julien-lebot/ICT207-Project
	void Stop()
	{
		m_shSkyFromSpace.Cleanup();
		m_shSkyFromAtmosphere.Cleanup();
		m_shGroundFromSpace.Cleanup();
		m_shGroundFromAtmosphere.Cleanup();
	}
コード例 #4
0
ファイル: ScatterGPU.cpp プロジェクト: fluffyfreak/sandbox
	virtual void Stop()
	{
		m_shSkyFromSpace.Cleanup();
		m_shSkyFromAtmosphere.Cleanup();
		m_shGroundFromSpace.Cleanup();
		m_shGroundFromAtmosphere.Cleanup();
		CInputTask::GetPtr()->RemoveInputEventListener(this);
	}
コード例 #5
0
	virtual bool Start()
	{
		CInputTask::GetPtr()->AddInputEventListener(this);
		CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 25));
		CCameraTask::GetPtr()->SetThrust(1.0f);

		m_nPolygonMode = GL_FILL;
		m_vLight = CVector(1000, 1000, 1000);
		m_vLightDirection = m_vLight / m_vLight.Magnitude();

		m_nSamples = 2;		// Number of sample rays to use in integral equation
		m_Kr = 0.0025f;		// Rayleigh scattering constant
		m_Kr4PI = m_Kr*4.0f*PI;
		m_Km = 0.0015f;		// Mie scattering constant
		m_Km4PI = m_Km*4.0f*PI;
		m_ESun = 15.0f;		// Sun brightness constant
		m_g = -0.95f;		// The Mie phase asymmetry factor

		m_fInnerRadius = 10.0f;
		m_fOuterRadius = 10.25f;
		m_fScale = 1 / (m_fOuterRadius - m_fInnerRadius);

		m_fWavelength[0] = 0.650f;		// 650 nm for red
		m_fWavelength[1] = 0.570f;		// 570 nm for green
		m_fWavelength[2] = 0.475f;		// 475 nm for blue
		m_fWavelength4[0] = powf(m_fWavelength[0], 4.0f);
		m_fWavelength4[1] = powf(m_fWavelength[1], 4.0f);
		m_fWavelength4[2] = powf(m_fWavelength[2], 4.0f);

		m_fRayleighScaleDepth = 0.25f;
		m_fMieScaleDepth = 0.1f;
		m_pbOpticalDepth.MakeOpticalDepthBuffer(m_fInnerRadius, m_fOuterRadius, m_fRayleighScaleDepth, m_fMieScaleDepth);
		m_tOpticalDepth.Init(&m_pbOpticalDepth);

		m_shSkyFromSpace.Init("shaders/SkyFromSpaceVert.glsl", "shaders/SkyFromSpaceFrag.glsl");
		m_shSkyFromAtmosphere.Init("shaders/SkyFromAtmosphereVert.glsl", "shaders/SkyFromAtmosphereFrag.glsl");
		m_shGroundFromSpace.Init("shaders/GroundFromSpaceVert.glsl", "shaders/GroundFromSpaceFrag.glsl");
		m_shGroundFromAtmosphere.Init("shaders/GroundFromAtmosphereVert.glsl", "shaders/GroundFromAtmosphereFrag.glsl");

		m_fExposure = 2.0f;
		m_fb.Init(800, 600, GL_RGBA16F_ARB);
		//m_fb.Init(800, 600, GL_RGBA8);
		m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRFrag.glsl");
		m_bHDR = true;
		return true;
	}
コード例 #6
0
ファイル: main.cpp プロジェクト: julien-lebot/ICT207-Project
	bool Start()
	{
		m_nPolygonMode = GL_FILL;
		m_vLight = Vector3f(1000, 1000, 1000);
		m_vLightDirection = m_vLight * (1.0f / m_vLight.magnitude());

		m_nSamples = 2;		// Number of sample rays to use in integral equation
		m_Kr = 0.0025f;		// Rayleigh scattering constant
		m_Kr4PI = m_Kr*4.0f*M_PI;
		m_Km = 0.0015f;		// Mie scattering constant
		m_Km4PI = m_Km*4.0f*M_PI;
		m_ESun = 15.0f;		// Sun brightness constant
		m_g = -0.95f;		// The Mie phase asymmetry factor

		float mFactor = 1.0f;
		m_fInnerRadius = 10.0f * mFactor;
		m_fOuterRadius = 10.25f * mFactor;
		m_fScale = 1 / (m_fOuterRadius - m_fInnerRadius);
		m_fScale *= mFactor;

		m_fWavelength[0] = 0.650f;		// 650 nm for red
		m_fWavelength[1] = 0.570f;		// 570 nm for green
		m_fWavelength[2] = 0.475f;		// 475 nm for blue
		m_fWavelength4[0] = powf(m_fWavelength[0], 4.0f);
		m_fWavelength4[1] = powf(m_fWavelength[1], 4.0f);
		m_fWavelength4[2] = powf(m_fWavelength[2], 4.0f);

		m_fRayleighScaleDepth = 0.25f;
		m_fMieScaleDepth = 0.1f;

		m_shSkyFromSpace.Init("shaders/SkyFromSpaceVert.glsl", "shaders/SkyFromSpaceFrag.glsl");
		m_shSkyFromAtmosphere.Init("shaders/SkyFromAtmosphereVert.glsl", "shaders/SkyFromAtmosphereFrag.glsl");
		m_shGroundFromSpace.Init("shaders/GroundFromSpaceVert.glsl", "shaders/GroundFromSpaceFrag.glsl");
		m_shGroundFromAtmosphere.Init("shaders/GroundFromAtmosphereVert.glsl", "shaders/GroundFromAtmosphereFrag.glsl");

		m_fExposure = 2.0f;
		m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRFrag.glsl");
		m_bHDR = false;
		return true;
	}
コード例 #7
0
ファイル: GLCloud2.cpp プロジェクト: sukharev/phd
	virtual bool Start()
	{
		CInputTask::GetPtr()->AddInputEventListener(this);
		CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 2));

		m_nPolygonMode = GL_FILL;

		m_cSphere.SetPosition(CVector(-15, 0, -50));
		m_cSphere.SetBoundingRadius(15.0f);
		m_cSphere2.SetPosition(CVector(10, 0, -50));
		m_cSphere2.SetBoundingRadius(20.0f);

		CPixelBuffer pb;
		pb.Init(128, 128, 128, 2, GL_LUMINANCE_ALPHA);
		pb.Make3DNoise(238653);
		m_tex.Init(&pb, false, false);
		m_shader.Init("shaders\\SwellVert.glsl", "shaders\\SwellFrag.glsl");
		return true;
	}
コード例 #8
0
ファイル: TestApp.cpp プロジェクト: sukharev/phd
	virtual void Update()
	{
		PROFILE("CAppTask::Update()", 1);

		if(m_bHDR && m_fb.IsValid())
		{
			m_fb.EnableFrameBuffer();
			if(m_bHDRSquare)
				glViewport(0, 0, 1024, 1024);
		}

		glClearColor(0.25f, 0.25f, 0.25f, 0.25f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		glPolygonMode(GL_FRONT, m_nPolygonMode);
		CMatrix4 mModel = m_srtModel.BuildModelMatrix();
		glPushMatrix();
		glMultMatrixf(mModel);
		glBegin(GL_TRIANGLES);
		glColor3f(1.0f,0.0f,0.0f);
		glVertex3f(0.0f, 1.0f, 0.0f);
		glColor3f(0.0f,1.0f,0.0f);
		glVertex3f(-1.0f,-1.0f, 0.0f);
		glColor3f(0.0f,0.0f,1.0f);
		glVertex3f(1.0f,-1.0f, 0.0f);
		glEnd();
		glPopMatrix();
		glPolygonMode(GL_FRONT, GL_FILL);

		if(m_bHDR && m_fb.IsValid())
		{
			m_fb.DisableFrameBuffer();
			if(m_bHDRSquare)
				glViewport(0, 0, CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight());
			CVideoTask::GetPtr()->GetFont().Begin();
			m_fb.EnableTexture();
			m_shHDR.Enable();
			m_shHDR.SetUniformParameter1f("fExposure", m_fExposure);
			m_shHDR.SetUniformParameter1i("s2Test", 0);
			glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
			glBegin(GL_QUADS);
			{
				if(m_bHDRSquare)
				{
					glTexCoord2f(0, 0); glVertex2i(10, CVideoTask::GetPtr()->GetHeight()-10);
					glTexCoord2f(1, 0); glVertex2i(CVideoTask::GetPtr()->GetWidth()-10, CVideoTask::GetPtr()->GetHeight()-10);
					glTexCoord2f(1, 1); glVertex2i(CVideoTask::GetPtr()->GetWidth()-10, 10);
					glTexCoord2f(0, 1); glVertex2i(10,  10);
				}
				else
				{
					glTexCoord2f(0, 0); glVertex2i(10, CVideoTask::GetPtr()->GetHeight()-10);
					glTexCoord2f(CVideoTask::GetPtr()->GetWidth(), 0); glVertex2i(CVideoTask::GetPtr()->GetWidth()-10, CVideoTask::GetPtr()->GetHeight()-10);
					glTexCoord2f(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight()); glVertex2i(CVideoTask::GetPtr()->GetWidth()-10, 10);
					glTexCoord2f(0, CVideoTask::GetPtr()->GetHeight()); glVertex2i(10,  10);
				}
			}
			glEnd();
			m_shHDR.Disable();
			m_fb.DisableTexture();

			char szBuffer[256];
			CVideoTask::GetPtr()->GetFont().SetPosition(0, 15);
			sprintf(szBuffer, "Exposure (+/-): %-2.2f", m_fExposure);
			CVideoTask::GetPtr()->GetFont().Print(szBuffer);
			CVideoTask::GetPtr()->GetFont().End();
		}
	}
コード例 #9
0
ファイル: TestApp.cpp プロジェクト: sukharev/phd
	virtual void Stop()
	{
		m_shHDR.Cleanup();
		m_fb.Cleanup();
		CInputTask::GetPtr()->RemoveInputEventListener(this);
	}
コード例 #10
0
ファイル: main.cpp プロジェクト: julien-lebot/ICT207-Project
	void Update(const Phoenix::Camera &cam)
	{
		glClearColor(0,0,0,0);
		// Cheap collision detection/response
		Vector3f vCamera = cam.getPosition();
		/*
		if(vCamera.magnitude() < m_fInnerRadius + 0.01f)
		{
			Vector3f N = vCamera / vCamera.Magnitude();
			Vector3f I = CCameraTask::GetPtr()->GetVelocity();
			float fSpeed = I.magnitude();
			I /= fSpeed;
			Vector3f R = N * (2.0*(-I | N)) + I;
			CCameraTask::GetPtr()->SetVelocity(R * fSpeed);

			vCamera = N * (m_fInnerRadius + 0.01f);
			CCameraTask::GetPtr()->SetPosition(vCamera);
		}
		*/
		//Vector3f vUnitCamera = vCamera / vCamera.magnitude();

		glPolygonMode(GL_FRONT, m_nPolygonMode);

		// Draw the groud sphere
		CGLShaderObject *pGroundShader;
		if(vCamera.magnitude() >= m_fOuterRadius)
			pGroundShader = &m_shGroundFromSpace;
		else
			pGroundShader = &m_shGroundFromAtmosphere;
		pGroundShader->Enable();
		pGroundShader->SetUniformParameter3f("v3CameraPos", vCamera.x, vCamera.y, vCamera.z);
		pGroundShader->SetUniformParameter3f("v3LightPos", m_vLightDirection.x, m_vLightDirection.y, m_vLightDirection.z);
		pGroundShader->SetUniformParameter3f("v3InvWavelength", 1/m_fWavelength4[0], 1/m_fWavelength4[1], 1/m_fWavelength4[2]);
		pGroundShader->SetUniformParameter1f("fCameraHeight", vCamera.magnitude());
		pGroundShader->SetUniformParameter1f("fCameraHeight2", vCamera.magnitudeSquared());
		pGroundShader->SetUniformParameter1f("fInnerRadius", m_fInnerRadius);
		pGroundShader->SetUniformParameter1f("fInnerRadius2", m_fInnerRadius*m_fInnerRadius);
		pGroundShader->SetUniformParameter1f("fOuterRadius", m_fOuterRadius);
		pGroundShader->SetUniformParameter1f("fOuterRadius2", m_fOuterRadius*m_fOuterRadius);
		pGroundShader->SetUniformParameter1f("fKrESun", m_Kr*m_ESun);
		pGroundShader->SetUniformParameter1f("fKmESun", m_Km*m_ESun);
		pGroundShader->SetUniformParameter1f("fKr4PI", m_Kr4PI);
		pGroundShader->SetUniformParameter1f("fKm4PI", m_Km4PI);
		pGroundShader->SetUniformParameter1f("fScale", 1.0f / (m_fOuterRadius - m_fInnerRadius));
		pGroundShader->SetUniformParameter1f("fScaleDepth", m_fRayleighScaleDepth);
		pGroundShader->SetUniformParameter1f("fScaleOverScaleDepth", (1.0f / (m_fOuterRadius - m_fInnerRadius)) / m_fRayleighScaleDepth);
		pGroundShader->SetUniformParameter1f("g", m_g);
		pGroundShader->SetUniformParameter1f("g2", m_g*m_g);
		pGroundShader->SetUniformParameter1i("nSamples", m_nSamples);
		pGroundShader->SetUniformParameter1f("fSamples", m_nSamples);
		//pGroundShader->SetUniformParameter1i("s2Test", 0);
		GLUquadricObj *pSphere = gluNewQuadric();
		//m_tEarth.Enable();
		gluSphere(pSphere, m_fInnerRadius, 100, 50);
		//m_tEarth.Disable();
		gluDeleteQuadric(pSphere);
		pGroundShader->Disable();

		// Draw the sky sphere
		CGLShaderObject *pSkyShader;
		if(vCamera.magnitude() >= m_fOuterRadius)
			pSkyShader = &m_shSkyFromSpace;
		else
			pSkyShader = &m_shSkyFromAtmosphere;
		pSkyShader->Enable();
		pSkyShader->SetUniformParameter3f("v3CameraPos", vCamera.x, vCamera.y, vCamera.z);
		pSkyShader->SetUniformParameter3f("v3LightPos", m_vLightDirection.x, m_vLightDirection.y, m_vLightDirection.z);
		pSkyShader->SetUniformParameter3f("v3InvWavelength", 1/m_fWavelength4[0], 1/m_fWavelength4[1], 1/m_fWavelength4[2]);
		pSkyShader->SetUniformParameter1f("fCameraHeight", vCamera.magnitude());
		pSkyShader->SetUniformParameter1f("fCameraHeight2", vCamera.magnitudeSquared());
		pSkyShader->SetUniformParameter1f("fInnerRadius", m_fInnerRadius);
		pSkyShader->SetUniformParameter1f("fInnerRadius2", m_fInnerRadius*m_fInnerRadius);
		pSkyShader->SetUniformParameter1f("fOuterRadius", m_fOuterRadius);
		pSkyShader->SetUniformParameter1f("fOuterRadius2", m_fOuterRadius*m_fOuterRadius);
		pSkyShader->SetUniformParameter1f("fKrESun", m_Kr*m_ESun);
		pSkyShader->SetUniformParameter1f("fKmESun", m_Km*m_ESun);
		pSkyShader->SetUniformParameter1f("fKr4PI", m_Kr4PI);
		pSkyShader->SetUniformParameter1f("fKm4PI", m_Km4PI);
		pSkyShader->SetUniformParameter1f("fScale", 1.0f / (m_fOuterRadius - m_fInnerRadius));
		pSkyShader->SetUniformParameter1f("fScaleDepth", m_fRayleighScaleDepth);
		pSkyShader->SetUniformParameter1f("fScaleOverScaleDepth", (1.0f / (m_fOuterRadius - m_fInnerRadius)) / m_fRayleighScaleDepth);
		pSkyShader->SetUniformParameter1f("g", m_g);
		pSkyShader->SetUniformParameter1f("g2", m_g*m_g);
		pSkyShader->SetUniformParameter1i("nSamples", m_nSamples);
		pSkyShader->SetUniformParameter1f("fSamples", m_nSamples);
		//m_tOpticalDepth.Enable();
		//pSkyShader->SetUniformParameter1f("tex", 0);
		glFrontFace(GL_CW);
		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE);
		pSphere = gluNewQuadric();
		gluSphere(pSphere, m_fOuterRadius, 100, 100);
		gluDeleteQuadric(pSphere);
		glDisable(GL_BLEND);
		glFrontFace(GL_CCW);
		//m_tOpticalDepth.Disable();
		pSkyShader->Disable();

		glPolygonMode(GL_FRONT, GL_FILL);
	}
コード例 #11
0
ファイル: ScatterGPU.cpp プロジェクト: fluffyfreak/sandbox
	virtual void Update()
	{
		PROFILE("CAppTask::Update()", 1);
		if(m_bHDR && m_fb.IsValid())
			m_fb.EnableFrameBuffer();

		// Cheap collision detection/response
		CVector vCamera = CCameraTask::GetPtr()->GetPosition();
		const float camMag = vCamera.Magnitude();
		const float camMagSqr = vCamera.MagnitudeSquared();
		if(camMag < m_fInnerRadius + 0.01f)
		{
			CVector N = vCamera / camMag;
			CVector I = CCameraTask::GetPtr()->GetVelocity();
			float fSpeed = I.Magnitude();
			I /= fSpeed;
			CVector R = N * (2.0f*(-I | N)) + I;
			CCameraTask::GetPtr()->SetVelocity(R * fSpeed);

			vCamera = N * (m_fInnerRadius + 0.01f);
			CCameraTask::GetPtr()->SetPosition(vCamera);
		}

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glPolygonMode(GL_FRONT, m_nPolygonMode);

		// Draw the groud sphere
		CGLShaderObject *pGroundShader;
		if(camMag >= m_fOuterRadius)
			pGroundShader = &m_shGroundFromSpace;
		else
			pGroundShader = &m_shGroundFromAtmosphere;
		pGroundShader->Enable();
		pGroundShader->SetUniformParameter3f("v3CameraPos", vCamera.x, vCamera.y, vCamera.z);
		pGroundShader->SetUniformParameter3f("v3LightPos", m_vLightDirection.x, m_vLightDirection.y, m_vLightDirection.z);
		pGroundShader->SetUniformParameter3f("v3InvWavelength", 1/m_fWavelength4[0], 1/m_fWavelength4[1], 1/m_fWavelength4[2]);
		pGroundShader->SetUniformParameter1f("fCameraHeight", camMag);
		pGroundShader->SetUniformParameter1f("fCameraHeight2", camMagSqr);
		pGroundShader->SetUniformParameter1f("fInnerRadius", m_fInnerRadius);
		pGroundShader->SetUniformParameter1f("fInnerRadius2", m_fInnerRadius*m_fInnerRadius);
		pGroundShader->SetUniformParameter1f("fOuterRadius", m_fOuterRadius);
		pGroundShader->SetUniformParameter1f("fOuterRadius2", m_fOuterRadius*m_fOuterRadius);
		pGroundShader->SetUniformParameter1f("fKrESun", m_Kr*m_ESun);
		pGroundShader->SetUniformParameter1f("fKmESun", m_Km*m_ESun);
		pGroundShader->SetUniformParameter1f("fKr4PI", m_Kr4PI);
		pGroundShader->SetUniformParameter1f("fKm4PI", m_Km4PI);
		pGroundShader->SetUniformParameter1f("fScale", 1.0f / (m_fOuterRadius - m_fInnerRadius));
		pGroundShader->SetUniformParameter1f("fScaleDepth", m_fRayleighScaleDepth);
		pGroundShader->SetUniformParameter1f("fScaleOverScaleDepth", (1.0f / (m_fOuterRadius - m_fInnerRadius)) / m_fRayleighScaleDepth);
		pGroundShader->SetUniformParameter1f("g", m_g);
		pGroundShader->SetUniformParameter1f("g2", m_g*m_g);
		pGroundShader->SetUniformParameter1i("nSamples", m_nSamples);
		pGroundShader->SetUniformParameter1f("fSamples", float(m_nSamples));
		pGroundShader->SetUniformParameter1i("s2Test", 0);
		GLUquadricObj *pSphere = gluNewQuadric();
		//m_tEarth.Enable();
		gluSphere(pSphere, m_fInnerRadius, 100, 50);
		//m_tEarth.Disable();
		gluDeleteQuadric(pSphere);
		pGroundShader->Disable();

		// Draw the sky sphere
		CGLShaderObject *pSkyShader;
		if(camMag >= m_fOuterRadius)
			pSkyShader = &m_shSkyFromSpace;
		else
			pSkyShader = &m_shSkyFromAtmosphere;
		pSkyShader->Enable();
		pSkyShader->SetUniformParameter3f("v3CameraPos", vCamera.x, vCamera.y, vCamera.z);
		pSkyShader->SetUniformParameter3f("v3LightPos", m_vLightDirection.x, m_vLightDirection.y, m_vLightDirection.z);
		pSkyShader->SetUniformParameter3f("v3InvWavelength", 1/m_fWavelength4[0], 1/m_fWavelength4[1], 1/m_fWavelength4[2]);
		pSkyShader->SetUniformParameter1f("fCameraHeight", camMag);
		pSkyShader->SetUniformParameter1f("fCameraHeight2", camMagSqr);
		pSkyShader->SetUniformParameter1f("fInnerRadius", m_fInnerRadius);
		pSkyShader->SetUniformParameter1f("fInnerRadius2", m_fInnerRadius*m_fInnerRadius);
		pSkyShader->SetUniformParameter1f("fOuterRadius", m_fOuterRadius);
		pSkyShader->SetUniformParameter1f("fOuterRadius2", m_fOuterRadius*m_fOuterRadius);
		pSkyShader->SetUniformParameter1f("fKrESun", m_Kr*m_ESun);
		pSkyShader->SetUniformParameter1f("fKmESun", m_Km*m_ESun);
		pSkyShader->SetUniformParameter1f("fKr4PI", m_Kr4PI);
		pSkyShader->SetUniformParameter1f("fKm4PI", m_Km4PI);
		pSkyShader->SetUniformParameter1f("fScale", 1.0f / (m_fOuterRadius - m_fInnerRadius));
		pSkyShader->SetUniformParameter1f("fScaleDepth", m_fRayleighScaleDepth);
		pSkyShader->SetUniformParameter1f("fScaleOverScaleDepth", (1.0f / (m_fOuterRadius - m_fInnerRadius)) / m_fRayleighScaleDepth);
		pSkyShader->SetUniformParameter1f("g", m_g);
		pSkyShader->SetUniformParameter1f("g2", m_g*m_g);
		pSkyShader->SetUniformParameter1i("nSamples", m_nSamples);
		pSkyShader->SetUniformParameter1f("fSamples", float(m_nSamples));
		glFrontFace(GL_CW);
		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE);
		pSphere = gluNewQuadric();
		gluSphere(pSphere, m_fOuterRadius, 100, 100);
		gluDeleteQuadric(pSphere);
		glDisable(GL_BLEND);
		glFrontFace(GL_CCW);
		pSkyShader->Disable();

		glPolygonMode(GL_FRONT, GL_FILL);

		if(m_bHDR && m_fb.IsValid())
		{
			m_fb.DisableFrameBuffer();
			CVideoTask::GetPtr()->GetFont().Begin();
			m_fb.EnableTexture();
			m_shHDR.Enable();
			m_shHDR.SetUniformParameter1f("fExposure", m_fExposure);
			m_shHDR.SetUniformParameter1i("s2Test", 0);
			glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
			glBegin(GL_QUADS);
			{
				glTexCoord2f(0, 0);     glVertex2i(0, 600);
				glTexCoord2f(800, 0);   glVertex2i(800, 600);
				glTexCoord2f(800, 600); glVertex2i(800, 0);
				glTexCoord2f(0, 600);   glVertex2i(0,  0);
			}
			glEnd();
			m_shHDR.Disable();
			m_fb.DisableTexture();
			CVideoTask::GetPtr()->GetFont().End();
		}

		glColor4ub(255, 255, 255, 255);
		char szBuffer[256];
		CFont &fFont = CVideoTask::GetPtr()->GetFont();
		fFont.Begin();
		fFont.SetPosition(0, 15);
		sprintf(szBuffer, "Samples (+/-): %d", m_nSamples);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 30);
		sprintf(szBuffer, "Kr (F5/Sh+F5): %-4.4f", m_Kr);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 45);
		sprintf(szBuffer, "Km (F6/Sh+F6): %-4.4f", m_Km);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 60);
		sprintf(szBuffer, "g (F7/Sh+F7): %-2.2f", m_g);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 75);
		sprintf(szBuffer, "ESun (F8/Sh+F8): %-1.1f", m_ESun);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 90);
		sprintf(szBuffer, "Red (F9/Sh+F9): %-3.3f", m_fWavelength[0]);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 105);
		sprintf(szBuffer, "Green (F10/Sh+F10): %-3.3f", m_fWavelength[1]);
		fFont.Print(szBuffer);
		fFont.SetPosition(0, 120);
		sprintf(szBuffer, "Blue (F11/Sh+F11): %-3.3f", m_fWavelength[2]);
		fFont.Print(szBuffer);
		fFont.End();
	}