View Full Version : Which is faster?
09-25-2003, 04:22 AM
I currently have a 128x128 mesh patch modelling a square of ocean water (so there's waves and stuff happening). I am currently storing a 2d heightmap in an array and using the X/Y indices of the array as the X/Z coordinates of the relevant vertex and the value at heightmap[X][Y] is used as the Y coordinate.
This keeps memory use down to a minimum but I have to use immediate rendering commands.
Would it be quicker to store all the vertex data and use Vertex Arrays, even thougn much more data will need to be fetched from memory (it will be 3 times as much).
One more question. The patch changes form constantly (as waves roll along), can this be compiled as a display list? or do display lists only work with static meshes?
it will go faster with vertexarrays..
the GPU still get 3 coords per point ( even if you create them at runtime, so the bus transfer wont increase), the memory footprint shouldnt me of too much concern here ( not yet), and you can evolve from normal arrays to VBO later, and gain yet more speed.
Silsplaylists only works for static objects.. it useually takes some time to create a DL so if you must recreate it frequently you only loose preformance.
09-26-2003, 04:01 AM
It probably depends on the exact nature of what you're rendering.
For something like a surfing simulator/game, you probably want to use 3 different levels to represent your ocean. Static for the very distant bit, a combination of a static surface and waves for the mid distance, and a fully dynamic modeling of THE wave. For the combination, you could store snapshots (may 10, for instance) of the waves in display lists and draw them successively, on top of various places of the undisturbed ocean.
This shouldn't be too hard to code. It's not going to be too great, but it'll give you something quick and dirty, so you'll have something to compare against when you'll be looking at more fancy solutions.
09-26-2003, 05:40 AM
Thanks for the replies, I am using a reasonably complicated statistical means of representing ocean water that uses FFTs to actually compute the height of the surface.
This means I have an array of complex numbers as a heightmap (the real part is the actual height) so I guess I'll have to copy the vertex values into an array after performing the FFT and pass that to glVertexPointer() function.
Hopefully this will up the framerates a touch http://www.opengl.org/discussion_boards/ubb/smile.gif (I got a 33% increase by recompiling the FFT library to use floats instead of doubles)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.