| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- //
- // Created by janco on 6/22/16.
- //
- #include <GL/gl.h>
- #include <GL/freeglut.h>
- #include "RandomObject.h"
- RandomObject::RandomObject(){
- for(int i = 0; i < 100; i++){
- randomobject.push_back(Vec3f(rand()%200*100, rand()%200*100, rand()%200*100));
- }
- }
- void RandomObject::draw() {
- glPushMatrix();
- glTranslatef(position.x, position.y, position.z);
- glRotated(rotation.x, rotation.y, rotation.z, 1);
- glScaled(scale,scale,scale);
- glBegin(GL_TRIANGLES);
- glVertex3f(-3.0, -5.0, 0.0);
- glVertex3f(4.0, 3.0, 2.0);
- glVertex3f(1.5, 2.0, 6.0);
- glEnd();
- glColor3f(1.0f, 0.0f, 0.0f);//needs to be called before RasterPos
- glRasterPos2i(-1, 2);
- void * font = GLUT_BITMAP_9_BY_15;
- for (std::string::iterator i = text.begin(); i != text.end(); ++i)
- {
- char c = *i;
- //this does nothing, color is fixed for Bitmaps when calling glRasterPos
- //glColor3f(1.0, 0.0, 1.0);
- glutBitmapCharacter(font, c);
- }
- glPopMatrix();
- }
|