#define USE_FORGE_CPU_COPY_HELPERS
#include <complex>
#include <cmath>
#include <vector>
#include <iostream>
using namespace std;
static const float XMIN = -32.0f;
static const float XMAX = 32.0f;
static const float YMIN = -32.0f;
static const float YMAX = 32.0f;
const float DX = 0.25;
const size_t XSIZE = (XMAX-XMIN)/DX;
const size_t YSIZE = (YMAX-YMIN)/DX;
void genSurface(float dx, std::vector<float> &vec )
{
vec.clear();
for(float x=XMIN; x < XMAX; x+=dx) {
for(float y=YMIN; y < YMAX; y+=dx) {
vec.push_back(x);
vec.push_back(y);
float z = sqrt(x*x+y*y) + 2.2204e-16;
vec.push_back(sin(z)/z);
}
}
}
int main(void)
{
wnd.makeCurrent();
chart.setAxesLimits(XMIN-2.0f, XMAX+2.0f, YMIN-2.0f, YMAX+2.0f, -0.5f, 1.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");
std::vector<float> function;
genSurface(DX, function);
do {
wnd.draw(chart);
} while(!wnd.close());
releaseGLBuffer(handle);
return 0;
}
void * ComputeResourceHandle
A backend-agnostic handle to a compute memory resource originating from an OpenGL resource.
Definition ComputeCopy.h:73
@ FORGE_VERTEX_BUFFER
OpenGL Vertex Buffer Object.
Definition ComputeCopy.h:77
Chart is base canvas where other plottable objects are rendered.
Definition chart.h:316
Surface is a graph to display three dimensional data.
Definition surface.h:163
FGAPI unsigned vertices() const
Get the buffer identifier for vertices.
FGAPI unsigned verticesSize() const
Get the vertex buffer size in bytes.
FGAPI void setColor(const forge::Color pColor)
Set the color of line graph(surface)
Window is where other objects such as Images, Plots etc.
Definition window.h:300
@ FG_YELLOW
Definition defines.h:143
@ FG_CHART_3D
Three dimensional charts.
Definition defines.h:119
@ f32
Definition defines.h:193
Definition ComputeCopy.h:80