DGL
https://delphigl.com/forum/

glVertex, glNormal for landscape drawing?
https://delphigl.com/forum/viewtopic.php?f=19&t=3971
Seite 1 von 1

Autor:  BTierens [ Sa Mär 26, 2005 21:20 ]
Betreff des Beitrags:  glVertex, glNormal for landscape drawing?

Hi,

I'm working on a project with a tile-based landscape.
There are serval types of tiles: water tiles, grass tiles, wall tiles,... Each tile has its own class (TWaterTile, TGrassTiles,...) with a draw procedure. This procedure uses glNormal3fv, glVertex3fv,... to draw the tile.
I've a 3-dimensional array where all the tiles are stored in. I draw the visible tiles using frustum culling and an OcTree.

This works quite nice. Should I use glNormal3fv, glVertex3fv,... to do the drawings or should I better use other methods?
Previously I used vertex arrays but that's rather restricted.

Autor:  Grizzly [ Sa Mär 26, 2005 21:56 ]
Betreff des Beitrags: 

normally I would prefer using vertexarrays or vertex buffer objects, since these are much faster.
But since you used those before i'd want to know why you these are too restricted for your needs?

Autor:  BTierens [ Sa Apr 02, 2005 09:56 ]
Betreff des Beitrags: 

It is not possible to enable or disable OpenGL capabilities while drawing a vertex array. If you use vertex array's for a tile based landscape you can't add a tile with more polygons or just remove a tile from the landscape.

I just found that my video card supports Vertex Buffers. I tried a nehe demo but i don't think that Vertex Buffers are faster than using glvertex3f.

Autor:  Flash [ Sa Apr 02, 2005 10:49 ]
Betreff des Beitrags: 

Does your card support the buffers in hardware, or are thy yust software emulated?[/code]

Autor:  BTierens [ Sa Apr 02, 2005 12:01 ]
Betreff des Beitrags: 

I previously thought VBO's were not supported so they might be emulated by mesa (I'm using Linux) or the driver.

Autor:  LarsMiddendorf [ Sa Apr 02, 2005 12:14 ]
Betreff des Beitrags: 

Vertex Buffers are usually many times faster than glbegin/glend. There are supported in hw since the gf1.

Autor:  BTierens [ Sa Apr 02, 2005 14:00 ]
Betreff des Beitrags: 

Thanks.
I can't find GL_ARB_vertex_buffer_object in the extention list at http://www.delphi3d.net/hardware/viewre ... eport=1076 so VBO's are probably emulated.

Autor:  Stucuk [ Sa Apr 02, 2005 17:11 ]
Betreff des Beitrags: 

Vertex Arrays are flexable. You just modify the data passed to them on the fly. For example say u hold all ur levels Vertex's in an arrray called Vertexs, and say u hold the face data in a array called Faces (original Names eh)

You can then have a procedure like

Code:
  1.  
  2. Procedure Draw;
  3. Var
  4. VertexList : array of TVector3f;
  5. x,y,c : integer;
  6. begin
  7.  
  8. C := 0;
  9.  
  10. SetLength(VertexList,NumOfVertexs); //NumOfVertexs = Amount in Vertexs array, we set it to the max amount since setting it over and over will cause lag
  11.  
  12. for x := 0 to NumOfFaces-1 do
  13. If Face[x].Draw then
  14. for y := Face[x].VertexStart to Face[x].VertexStart+Face[x].NumOfVerts-1 do
  15. begin
  16. VertexList[c] := Vertexs[y];
  17. inc(c);
  18. end;
  19.  
  20.  
  21. Pass VertexList to array with c as the count
  22. ...
  23. Etc
  24.  
  25. end;
  26.  


Making a list each frame doesn't seem to cause any lag

Autor:  BTierens [ Mo Apr 04, 2005 20:59 ]
Betreff des Beitrags: 

Is it possible to change the textures while using vertex array's? Or should I put all textures in one texture and then change the texture coördinates?

Autor:  Stucuk [ Di Apr 05, 2005 13:58 ]
Betreff des Beitrags: 

when i use them im only sending one face to opengl at a time. so a texture is bound for each face.

Your solution may work better for you.

Autor:  McCLaw [ Mi Apr 20, 2005 09:08 ]
Betreff des Beitrags: 

Your best solution would probably be to sort the frustrum culled tiles by the type of textures you are applying, and use a VBO per list of Tiles

This way you get the maximum amount of polygons in one list, with the least amount of material changes. :)

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/