23 #if defined (HAVE_CONFIG_H) 37 GLdouble p_matrix[16];
40 glGetDoublev (GL_PROJECTION_MATRIX, p_matrix);
41 glGetIntegerv (GL_VIEWPORT, viewport);
42 glMatrixMode (GL_PROJECTION);
45 glMultMatrixd (p_matrix);
46 glMatrixMode (GL_MODELVIEW);
63 # define BUFFER_SIZE 128 68 glEnable (GL_DEPTH_TEST);
69 glDepthFunc (GL_LEQUAL);
77 glRenderMode (GL_SELECT);
84 int hits = glRenderMode (GL_RENDER);
89 GLuint current_minZ = 0xffffffff;
90 GLuint current_name = 0xffffffff;
94 GLuint n = select_buffer[j++],
95 minZ = select_buffer[j++];
98 if (((flags &
select_last) == 0 && (minZ <= current_minZ))
99 || ((flags &
select_last) != 0 && (minZ >= current_minZ)))
101 bool candidate =
true;
125 if (current_name != 0xffffffff)
129 warning (
"opengl_selector::select: selection buffer overflow");
160 xp2(0) += (bbox(0) + bbox(2));
161 xp2(1) -= (bbox(1) + bbox(3));
171 glVertex3dv (p1.
data ());
172 glVertex3dv (p2.
data ());
173 glVertex3dv (p3.
data ());
174 glVertex3dv (p4.
data ());
181 if (props.get_string ().isempty ())
184 Matrix pos = props.get_data_position ();
185 const Matrix bbox = props.get_extent_matrix ();
187 fake_text (pos(0), pos(1), pos.
numel () > 2 ? pos(2) : 0.0, bbox);
192 double x,
double y,
double z,
193 int halign,
int valign,
double rotation)
209 Matrix xd = props.get_xdata ().matrix_value ();
211 double x_pix_size = (nc == 1 ? 1 : (xd(1) - xd(0)) / (nc - 1));
213 Matrix yd = props.get_ydata ().matrix_value ();
215 double y_pix_size = (nr == 1 ? 1 : (yd(1) - yd(0)) / (nr - 1));
217 ColumnVector p1(3, 0.0), p2(3, 0.0), p3(3, 0.0), p4(3, 0.0);
218 p1(0) = xd(0) - x_pix_size/2;
219 p1(1) = yd(0) - y_pix_size/2;
221 p2(0) = xd(1) + x_pix_size/2;
222 p2(1) = yd(0) - y_pix_size/2;
224 p3(0) = xd(1) + x_pix_size/2;
225 p3(1) = yd(1) + y_pix_size/2;
227 p4(0) = xd(0) - x_pix_size/2;
228 p4(1) = yd(1) + y_pix_size/2;
231 glVertex3dv (p1.data ());
232 glVertex3dv (p2.data ());
233 glVertex3dv (p3.data ());
234 glVertex3dv (p4.
data ());
virtual void set_selecting(bool on)
virtual void init_marker(const std::string &m, double size, float width)
const T * data(void) const
virtual void draw(const graphics_object &go, bool toplevel=true)
virtual void init_marker(const std::string &m, double size, float width)
virtual void setup_opengl_transformation(const axes::properties &props)
virtual void setup_opengl_transformation(const axes::properties &props)
std::map< GLuint, graphics_object > object_map
graphics_object select(const graphics_object &ax, int x, int y, int flags=0)
void apply_pick_matrix(void)
nd deftypefn *std::string name
void fake_text(double x, double y, double z, const Matrix &bbox, bool use_scale=true)
virtual void draw_image(const image::properties &props)
base_properties & get_properties(void)
virtual graphics_xform get_transform(void) const
void warning(const char *fmt,...)
virtual void draw(const graphics_object &go, bool toplevel=true)
virtual void text_to_pixels(const std::string &txt, uint8NDArray &pixels, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
the element is set to zero In other the statement xample y
virtual Matrix render_text(const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
octave_idx_type numel(void) const
Number of elements in the array.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
virtual void draw_text(const text::properties &props)
charNDArray min(char d, const charNDArray &m)