

To check the number of vertex texture units available, use this code fragment: It is therefore possible that this technique does not work on your card. It is allowed that graphics cards have zero texture units available in the vertex shader. NOTE: although core OpenGL ES 2.0 supports texture lookups in the vertex shader, The solution is simple, we put fixed x coordinates in a 1-dimension vertex buffer object (VBO),Īnd put the y coordinates in a 1-dimensional texture,Īnd have the vertex shader combine the two. We also do not want to change the vertices as we move around or zoom in and out of the graph. So it would be nice if we can separate the number of vertices that we draw from the number of data points that we have. Secondly, if we have thousands of data points, it really is useless to plot all of them in a window that may not even be a thousand pixels wide. It would be very nice if we could put that into a buffer without any further processing,Īnd have the graphics card do something useful with it.

In fact, when taking data from an ADC (such as from a microphone connected to a sound card), We don't want to store the x coordinates in memory if they can easily be recovered programmatically. In this tutorial, we will approach the problem of plotting data points very differently.įirst, we are usually more interested in the y coordinates, the x coordinates are just equally spaced in the domain of interest. This is straightforward and works very well, if we do not have too much data. We plotted a function by creating 2-dimensional vertices for all the data points we had.
