• Advertisement
Sign in to follow this  

GL_LINES

This topic is 4953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Quote:
Original post by supagu

camera.LookAt();
glLoadIdentity();


Is that really what you want, loading the identity matrix right after setting the camera?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement