EMAN2
glutil.h
Go to the documentation of this file.
1/*
2 * Author: David Woolford, 11/06/2007 (woolford@bcm.edu)
3 * Copyright (c) 2000-2006 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31#ifndef glutil_h__
32#define glutil_h__
33
34#include <vector>
35#include "vec3.h"
36#include "transform.h"
37#include "emdata.h"
38
39#ifdef __APPLE__
40 #include "OpenGL/gl.h"
41#else // WIN32, LINUX
42 #include "GL/gl.h"
43#endif //__APPLE__
44
45using std::vector;
46
47namespace EMAN
48{
49 class EMData;
50 class MarchingCubes;
51
52 class GLUtil {
53 public:
57 static unsigned int gen_glu_mipmaps(const EMData* const emdata);
58
64 static unsigned int gen_gl_texture(const EMData* const emdata, GLenum format = GL_LUMINANCE);
65
69 static unsigned int render_amp8_gl_texture(EMData* emdata, int x0, int y0, int ixsize, int iysize, int bpl, float scale, int mingray, int maxgray, float render_min, float render_max,float gamma,int flags);
70
74 static int nearest_projected_points(const vector<float>& model_matrix, const vector<float>& proj_matrix, const vector<int>& view_matrix, const vector<Vec3f>& points, const float mouse_x, const float mouse_y,const float& nearnes);
75 static void colored_rectangle(const vector<float>& data,const float& alpha, const bool center_point=false);
76 static void mx_bbox(const vector<float>& data, const vector<float>& text_color, const vector<float>& bg_color);
77
96 static EMBytes render_amp8(EMData * emdata, int x, int y, int xsize, int ysize,
97 int bpl, float scale, int min_gray, int max_gray,
98 float min_render, float max_render,float gamma,int flags);
99
106 static unsigned long get_isosurface_dl(MarchingCubes* mc, unsigned int tex_id = 0, bool surface_face_z = false, bool recontour = true);
107
109 static void render_using_VBOs(MarchingCubes* mc, unsigned int tex_id = 0, bool surface_face_z = false);
110
113
118 static void glLoadMatrix(const Transform& xform);
119
124 static void glMultMatrix(const Transform& xform);
125
127 static void glDrawBoundingBox(float width, float height, float depth);
128
129 static void glDrawDisk(float radius, int spokes);
130
131 private:
132 //This is a buffer for the bounding box
133 static GLuint buffer[2];
134
135 };
136}
137
138#endif //glutil_h__
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
static void mx_bbox(const vector< float > &data, const vector< float > &text_color, const vector< float > &bg_color)
static void render_using_VBOs(MarchingCubes *mc, unsigned int tex_id=0, bool surface_face_z=false)
Render a isosurface using buffer objects, this uses non-deprecated methods and improves performance.
static void colored_rectangle(const vector< float > &data, const float &alpha, const bool center_point=false)
static EMBytes render_amp8(EMData *emdata, int x, int y, int xsize, int ysize, int bpl, float scale, int min_gray, int max_gray, float min_render, float max_render, float gamma, int flags)
Render the image into an 8-bit image.
static void glDrawBoundingBox(float width, float height, float depth)
Draw a bounding box.
static void glMultMatrix(const Transform &xform)
Mult a EMAN style transform to open GL w/o having to go through python Calls glMultTransposeMatrix ra...
static int nearest_projected_points(const vector< float > &model_matrix, const vector< float > &proj_matrix, const vector< int > &view_matrix, const vector< Vec3f > &points, const float mouse_x, const float mouse_y, const float &nearnes)
Determine the intersection of ....
static unsigned int render_amp8_gl_texture(EMData *emdata, int x0, int y0, int ixsize, int iysize, int bpl, float scale, int mingray, int maxgray, float render_min, float render_max, float gamma, int flags)
create an OpenGL texture using render_amp8
static unsigned int gen_glu_mipmaps(const EMData *const emdata)
create an OpenGL mipmap set
static void contour_isosurface(MarchingCubes *mc)
Recountour isosurface, for use with VBOs.
static void glLoadMatrix(const Transform &xform)
Load a EMAN style transform to open GL w/o having to go through python Calls glLoadTransposeMatrix ra...
static void glDrawDisk(float radius, int spokes)
static unsigned int gen_gl_texture(const EMData *const emdata, GLenum format=GL_LUMINANCE)
create an OpenGL texture
static GLuint buffer[2]
Definition: glutil.h:133
static unsigned long get_isosurface_dl(MarchingCubes *mc, unsigned int tex_id=0, bool surface_face_z=false, bool recontour=true)
Get an isosurface display list Traverses the tree, marches the cubes, and renders a display list usin...
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
E2Exception class.
Definition: aligner.h:40
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517