Advertisement
f1recracker

Untitled

Mar 29th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //Compile gcc <filename> -lGL -lglut
  2.  
  3. #include <iostream>
  4. #include <GL/glut.h>
  5.  
  6. using namespace std;
  7.  
  8. void bold2DPoint(float x, float y){
  9. glBegin(GL_POINTS);
  10. glVertex2f(x , y );
  11. glVertex2f(x , y+1);
  12. glVertex2f(x+1, y );
  13. glVertex2f(x+1, y+1);
  14. glEnd();
  15. }
  16.  
  17. void QR(){
  18. matrix [i][j] = {0};
  19. for (int i = 0; i < 25; i+=2){
  20. for (int j = 0; j < 25; j+=2){
  21. if (matrix[i][j] == 1){
  22. bold2DPoint(i, -1*j);
  23. }
  24. }
  25. }
  26. }
  27.  
  28. void display(){
  29. glClear(GL_COLOR_BUFFER_BIT);
  30. glColor3f(0.0, 0.0, 0.0);
  31. QR();
  32. glFlush();
  33. }
  34.  
  35. void init(){
  36. glClearColor(1.0, 1.0, 1.0, 1.0);
  37. glMatrixMode(GL_PROJECTION);
  38. glLoadIdentity();
  39. glOrtho(-400, 400, -400, 400, -1.0, 1.0);
  40. }
  41.  
  42. int main(int argc, char** argv){
  43. glutInit(&argc, argv);
  44. glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  45. glutInitWindowSize(800,800);
  46. glutInitWindowPosition(100,100);
  47. glutCreateWindow("QR Code Generator");
  48. init();
  49. glutDisplayFunc(display);
  50. glutMainLoop();
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement