tests/cuda3.2/tests/oceanFFT/oceanFFT.cpp
void createMeshPositionVBO(GLuint *id, int w, int h)
{
    createVBO(id, w*h*4*sizeof(float));

    glBindBuffer(GL_ARRAY_BUFFER, *id);
    float *pos = (float *) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
    if (!pos) {
        return;
    }
    
    for(int y=0; y<h; y++) {
        for(int x=0; x<w; x++) {
            float u = x / (float) (w-1);
            float v = y / (float) (h-1);
            *pos++ = u*2.0f-1.0f;
            *pos++ = 0.0f;
            *pos++ = v*2.0f-1.0f;
            *pos++ = 1.0f;
        }
    }

    glUnmapBuffer(GL_ARRAY_BUFFER);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}
// create fixed vertex buffer to store mesh vertices
create fixed vertex buffer to store mesh vertices
create fixed vertex buffer to store mesh vertices
void createMeshPositionVBO(GLuint *id, int w, int h)
{
    createVBO(id, w*h*4*sizeof(float));
    glBindBuffer(GL_ARRAY_BUFFER, *id);
    float *pos = (float *) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
    if (!pos) {
        return;
    }
    for(int y=0; y<h; y++) {
        for(int x=0; x<w; x++) {
            float u = x / (float) (w-1);
            float v = y / (float) (h-1);
            *pos++ = u*2.0f-1.0f;
            *pos++ = 0.0f;
            *pos++ = v*2.0f-1.0f;
            *pos++ = 1.0f;
        }
    }
    glUnmapBuffer(GL_ARRAY_BUFFER);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void createMeshPositionVBO ( GLuint * id , int w , int h ) { createVBO ( id , w * h * 4 * sizeof ( float ) ) ; glBindBuffer ( GL_ARRAY_BUFFER , * id ) ; float * pos = ( float * ) glMapBuffer ( GL_ARRAY_BUFFER , GL_WRITE_ONLY ) ; if ( ! pos ) { return ; } for ( int y = 0 ; y < h ; y ++ ) { for ( int x = 0 ; x < w ; x ++ ) { float u = x / ( float ) ( w - 1 ) ; float v = y / ( float ) ( h - 1 ) ; * pos ++ = u * 2.0f - 1.0f ; * pos ++ = 0.0f ; * pos ++ = v * 2.0f - 1.0f ; * pos ++ = 1.0f ; } } glUnmapBuffer ( GL_ARRAY_BUFFER ) ; glBindBuffer ( GL_ARRAY_BUFFER , 0 ) ; }
create fixed vertex buffer to store mesh vertices
create fixed vertex buffer to store mesh vertices