Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## scie204.cpp - added
- #include <algorithm> // for sort()
- ## DrawGLScene - added one line below
- int DrawGLScene()
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear Screen And Depth Buffer
- glLoadIdentity();//Reset The Current Modelview Matrix
- glPushMatrix();
- glTranslatef(0.0f, 0.0f, -12.0f);//move away (always need to do this)
- ////////////////////////////////////
- //start drawing
- ## added this here
- // before drawing anything, sort the array in z-order from farthest to nearest
- // to make alpha blending work right
- std::sort(winter, winter + 74, cmp_flakes);
- ## c_flakes.cpp added
- // this shouldn't really go here, but whatever...
- bool cmp_flakes(const c_flakes &a, const c_flakes &b)
- {
- return (a.zPos < b.zPos);
- }
- ## c_flakes.h added (must go at the bottom)
- // not the right place for this...
- bool cmp_flakes(const c_flakes &a, const c_flakes &b);
Add Comment
Please, Sign In to add comment