summaryrefslogtreecommitdiffstats
path: root/src/controller/clear_selection.sqc (plain)
blob: cf04681cb23af1b1249b0a6833258c9e12962dc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* I seem to need this for glGenBuffers as per
   http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */
#define GL_GLEXT_PROTOTYPES

#include "clear_selection.h"
#include "../view/exp004state0.h"
#include <GL/glut.h>

EXEC SQL INCLUDE sqlca;

/*
 * A simple alias to make the code more readable.
 */
#define S exp004state0

void
clear_selection (void)
{
  /*
   * WHERE gi IS NOT NULL is added to prevent the PRECOMPILE command
   * from throwing a warning about modifying an entire table.  Since
   * gi is defined as NOT NULL this will clear the entire table.
   */
  EXEC SQL DELETE FROM vis_selection WHERE gi IS NOT NULL;

  EXEC SQL COMMIT;

  for (unsigned int i = 0; i < ROWS; i++)
    {
      S.selection[i] = false;
      S.base_colors_data[i][0] = DEFAULT_COLOR_R;
      S.base_colors_data[i][1] = DEFAULT_COLOR_G;
      S.base_colors_data[i][2] = DEFAULT_COLOR_B;
    }

  glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]);
  glColorPointer (3, GL_FLOAT, 0, 0);
  glBufferData (GL_ARRAY_BUFFER,
		sizeof (S.base_colors_data), S.base_colors_data,
		GL_STATIC_DRAW);

  glutPostRedisplay ();

  return;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.