Sign in to follow this  
supagu

GL_LINES

Recommended Posts

supagu    148
should the code eblow work? im trying to draw a list of lines, but nothing seems to be comming up? <cpp> StarField::StarField(int numStars) { stars.resize(numStars); for (int l = 0; l < stars.size(); ++l) { stars[l].start = Vector3(rand() % 1000 / 100.0f, rand() % 1000 / 100.0f, rand() % 1000 / 100.0f); } } void StarField::Update(Vector3 change) { for (int l = 0; l < stars.size(); ++l) { stars[l].end = Vector3(0,0,0); //stars[l].start + change; } } void StarField::Render(Camera& camera) { camera.LookAt(); glLoadIdentity(); glLineWidth(5); glColor4f(1,1,1,1); glBegin(GL_LINES); { for (int l = 0; l < stars.size(); ++l) { Vector3 start = stars[l].start; Vector3 end = stars[l].end; glVertex3f(stars[l].start[Vector3::X], stars[l].start[Vector3::Y], stars[l].start[Vector3::Z]); glVertex3f(stars[l].end[Vector3::X], stars[l].end[Vector3::Y], stars[l].end[Vector3::Z]); } } glEnd(); } </cpp>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this