Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About steven78

  • Rank
  1. steven78

    How can I optimize this code?

    Thanks at all! The NeHe Lesson seems to be quit good, some month ago I've started at lesson 1. :-) @uavfun: to do it with less triangles seems to be quit hard, cause the data is fix and come from a comprehensive computation... But you are right, the data is contiguous, it describes a hugh surface, divided in triangles.
  2. int Draw (Zone zone) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0f,0.0f,-zoom); glPushMatrix(); glMultMatrixf(Transform.M); glColor3f(0.5f, 0.6f, 0.7f); glBegin(GL_TRIANGLES); for (int i = 0; i < zone.Triangles.size(); i++) { double x_1 = zone.Triangles.P1.X(); double y_1 = zone.Triangles.P1.Y(); double z_1 = zone.Triangles.P1.Z(); double x_2 = zone.Triangles.P2.X(); double y_2 = zone.Triangles.P2.Y(); double z_2 = zone.Triangles.P2.Z(); double x_3 = zone.Triangles.P3.X(); double y_3 = zone.Triangles.P3.Y(); double z_3 = zone.Triangles.P3.Z(); glVertex3d(x_1,y_1,z_1); glVertex3d(x_2,y_2,z_2); glVertex3d(x_3,y_3,z_3); } glEnd(); glPopMatrix(); glFlush (); return TRUE; } While doing some Mouse-manipulation (zoom, rotation ...) the redrawing of the triangles is much to slow, because I have more than 100000 triangles. What can I do? By the way: How can I mark the code as code?
  3. Hello! I have a huge set of coordinates, which represent single triangles. That means, that more than 200000 (small) triangles are located in the 3d-space in that way, that they describe the open water surface. I want to animate the water. Therefore I have the same huge data for every timestep. But for the moment I have enough problems in drawing the triangles for just one timestep. The easy way doing it with glBegin...glVertex3d...glEnd for every triangle is much to slow. If I want to change the view to my result via mouse movements, I have no smooth animation. Any ideas doing the drawing in a better way? And by the way: What might be an easy way to shade the triangles that they look like real water?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!