34 GLdouble p_matrix[16];
37 glGetDoublev (GL_PROJECTION_MATRIX, p_matrix);
38 glGetIntegerv (GL_VIEWPORT, viewport);
39 glMatrixMode (GL_PROJECTION);
42 glMultMatrixd (p_matrix);
43 glMatrixMode (GL_MODELVIEW);
49 opengl_renderer::setup_opengl_transformation (props);
56 opengl_renderer::init_marker (m, sz, width);
60 # define BUFFER_SIZE 128
65 glEnable (GL_DEPTH_TEST);
66 glDepthFunc (GL_LEQUAL);
74 glRenderMode (GL_SELECT);
81 int hits = glRenderMode (GL_RENDER);
86 GLuint current_minZ = 0xffffffff;
87 GLuint current_name = 0xffffffff;
89 for (
int i = 0, j = 0; i < hits && j <
BUFFER_SIZE-3; i++)
91 GLuint n = select_buffer[j++],
92 minZ = select_buffer[j++];
95 if (((flags &
select_last) == 0 && (minZ <= current_minZ))
96 || ((flags & select_last) != 0 && (minZ >= current_minZ)))
98 bool candidate =
true;
100 select_buffer[
std::min (j + n, GLuint (BUFFER_SIZE)) - 1];
122 if (current_name != 0xffffffff)
126 warning (
"opengl_selector::select: selection buffer overflow");
140 opengl_renderer::draw (go, toplevel);
150 xpos = get_transform ().transform (x, y, z, use_scale);
155 xp2(0) += (bbox(0) + bbox(2));
156 xp2(1) -= (bbox(1) + bbox(3));
160 p1 = get_transform ().untransform (xp1(0), xp1(1), xp1(2),
false);
161 p2 = get_transform ().untransform (xp2(0), xp1(1), xp1(2),
false);
162 p3 = get_transform ().untransform (xp2(0), xp2(1), xp1(2),
false);
163 p4 = get_transform ().untransform (xp1(0), xp2(1), xp1(2),
false);
166 glVertex3dv (p1.
data ());
167 glVertex3dv (p2.
data ());
168 glVertex3dv (p3.
data ());
169 glVertex3dv (p4.
data ());
182 fake_text (pos(0), pos(1), pos.
numel () > 2 ? pos(2) : 0.0, bbox);
187 double x,
double y,
double z,
188 int halign,
int valign,
double rotation)
196 text_to_pixels (txt, pixels, bbox, halign, valign, rotation);
201 return Matrix (1, 4, 0.0);
210 double x_pix_size = (xd(1) - xd(0)) / (nc - 1);
214 double y_pix_size = (yd(1) - yd(0)) / (nr - 1);
216 ColumnVector p1(3, 0.0), p2(3, 0.0), p3(3, 0.0), p4(3, 0.0);
217 p1(0) = xd(0) - x_pix_size/2;
218 p1(1) = yd(0) - y_pix_size/2;
220 p2(0) = xd(1) + x_pix_size/2;
221 p2(1) = yd(0) - y_pix_size/2;
223 p3(0) = xd(1) + x_pix_size/2;
224 p3(1) = yd(1) + y_pix_size/2;
226 p4(0) = xd(0) - x_pix_size/2;
227 p4(1) = yd(1) + y_pix_size/2;
230 glVertex3dv (p1.data ());
231 glVertex3dv (p2.data ());
232 glVertex3dv (p3.data ());
233 glVertex3dv (p4.
data ());
Matrix get_data_position(void) const
octave_value get_cdata(void) const
octave_idx_type numel(void) const
Number of elements in the array.
virtual Matrix render_text(const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
virtual void draw_image(const image::properties &props)
octave_value get_xdata(void) const
octave_idx_type rows(void) const
void fake_text(double x, double y, double z, const Matrix &bbox, bool use_scale=true)
octave_value get_ydata(void) const
virtual void draw(const graphics_object &go, bool toplevel=true)
bool is_hittest(void) const
virtual void draw_text(const text::properties &props)
Matrix get_extent_matrix(void) const
virtual void setup_opengl_transformation(const axes::properties &props)
void apply_pick_matrix(void)
const T * data(void) const
base_properties & get_properties(void)
Matrix matrix_value(bool frc_str_conv=false) const
octave_value get_string(void) const
void warning(const char *fmt,...)
bool is_empty(void) const
std::map< GLuint, graphics_object > object_map
virtual void init_marker(const std::string &m, double size, float width)
octave_idx_type columns(void) const
F77_RET_T const double * x
charNDArray min(char d, const charNDArray &m)
graphics_object select(const graphics_object &ax, int x, int y, int flags=0)