Guest User

Untitled

a guest
May 26th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. ## scie204.cpp - added
  2. #include <algorithm> // for sort()
  3.  
  4. ## DrawGLScene - added one line below
  5.  
  6. int DrawGLScene()
  7. {
  8. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear Screen And Depth Buffer
  9. glLoadIdentity();//Reset The Current Modelview Matrix
  10. glPushMatrix();
  11. glTranslatef(0.0f, 0.0f, -12.0f);//move away (always need to do this)
  12.  
  13.  
  14.  
  15. ////////////////////////////////////
  16. //start drawing
  17.  
  18. ## added this here
  19. // before drawing anything, sort the array in z-order from farthest to nearest
  20. // to make alpha blending work right
  21. std::sort(winter, winter + 74, cmp_flakes);
  22.  
  23. ## c_flakes.cpp added
  24. // this shouldn't really go here, but whatever...
  25. bool cmp_flakes(const c_flakes &a, const c_flakes &b)
  26. {
  27. return (a.zPos < b.zPos);
  28. }
  29.  
  30. ## c_flakes.h added (must go at the bottom)
  31. // not the right place for this...
  32. bool cmp_flakes(const c_flakes &a, const c_flakes &b);
Add Comment
Please, Sign In to add comment