Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012
00013 #include "glut-demo/glut-demo.h"
00014 #include "opengl-effects/opengl-effects.h"
00015 #include "perf/perf.h"
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 class TestHost : public glut::DemoHost {
00026 public:
00027
00028 ~TestHost(void) throw() { }
00029
00030
00031 void onInit(void) {
00032 glut::sphere_init_t si;
00033 si.radius = 1.0;
00034 si.nRings = 5;
00035 si.color.red = 255;
00036 si.color.green = 128;
00037 si.color.blue = 192;
00038 si.color.alpha = 128;
00039
00040 m_sphere = glut::createCoolSphere(si);
00041 ASSERT(m_sphere, "null");
00042 }
00043
00044 void display3D(IN const glut::render_context_t& rc,
00045 IN glut::RenderQueue * rq) {
00046 ASSERT(m_sphere, "null");
00047
00048 glut::render_context_t rc2 = rc;
00049 rc2.placement.position.x = 2.0;
00050 rc2.placement.position.y = 2.0;
00051 rc2.placement.position.z = 2.0;
00052
00053 glMatrixMode(GL_MODELVIEW);
00054 glPushMatrix();
00055 glTranslatef(2, 2, 2);
00056 rc2.placement.position.y = 2.0;
00057 m_sphere->render(rc2, rq);
00058 glTranslatef(0, -4, 0);
00059 rc2.placement.position.y = -2.0;
00060 m_sphere->render(rc2, rq);
00061 glTranslatef(0, +8, 0);
00062 rc2.placement.position.y = +6.0;
00063 m_sphere->render(rc2, rq);
00064 glPopMatrix();
00065 }
00066
00067 private:
00068
00069 smart_ptr<glut::Renderable> m_sphere;
00070 };
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 int
00081 main
00082 (
00083 IN int argc,
00084 IN const char * argv[]
00085 )
00086 {
00087 int retval = 0;
00088 try {
00089 perf::Timer timer("overall timer");
00090
00091 const char * title = "OpenGL Effects Demo - Sphere";
00092
00093
00094 TestHost host;
00095
00096
00097 glut::startDemo(argc, argv, title, &host);
00098
00099 } catch (std::exception& e) {
00100 DPRINTF("EXCEPTION: %s", e.what());
00101 retval = 1;
00102 }
00103
00104 perf::dumpTimingSummary(std::cerr);
00105
00106 return retval;
00107 }
00108