Facebook
From Gentle Agouti, 8 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 378
  1. #include "StdAfx.h"
  2. #include "Uklad.h"
  3.  
  4.  
  5. CUklad::CUklad(void)
  6. {
  7. }
  8.  
  9. CUklad::~CUklad(void)
  10. {
  11. }
  12.  
  13. void CUklad::Wymiary(int x)
  14. {
  15.        
  16. }
  17.  
  18. void CUklad::drawText(int x, int y, char *string) // rysuje napis "string" w pozycji x, y
  19. {
  20. glRasterPos2f(x, y);//pozycja napisu
  21. for (int i = 0; i < strlen (string); i++)//literka po literce
  22. glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, string[i]);
  23. };
  24.  
  25. void CUklad::Rysuj()
  26. {
  27.         glColor3f(0,0,0);                                       // Rysowanie ukladu:
  28.                                                                                
  29.         glBegin(GL_LINE_STRIP);                         // oś X
  30.  
  31.         glVertex3f(-110.0, 0.0, 0.0);          
  32.         glVertex3f(110.0, 0.0, 0.0);
  33.         glVertex3f(100.0, 5.0, 0.0);
  34.         glVertex3f(110.0, 0.0, 0.0);
  35.         glVertex3f(100.0, -5.0, 0.0);
  36.         glEnd();
  37.  
  38.         drawText(100,-10,"X");
  39.  
  40.         glBegin(GL_LINE_STRIP);                         // oś Y
  41.  
  42.         glVertex3f(0.0, -82.0, 0.0);           
  43.         glVertex3f(0.0, 82.0, 0.0);
  44.         glVertex3f(-5.0, 72.0, 0.0);
  45.         glVertex3f(0.0, 82.0, 0.0);
  46.         glVertex3f(5.0, 72.0, 0.0);
  47.         glEnd();
  48.  
  49.         drawText(5, 75,"Y");
  50.  
  51.         /*for(int i=-100; i<=100; i+=10)
  52.         {
  53.                 //itoa(i, znak[i], 10);
  54.                 //drawText(i, -7, znak[i]);
  55.  
  56.                 //drawNumber(i, -7, i);
  57.                 glRasterPos2f(x*(i-5), -5);
  58.                 glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '0');
  59.  
  60.                 glRasterPos2f(-5, x*(i-5));
  61.                 glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '0');
  62.         }*/
  63. }