00001 00005 /* 00006 * Author: David Woolford, 11/06/2007 (woolford@bcm.edu) 00007 * Copyright (c) 2000-2006 Baylor College of Medicine 00008 * 00009 * This software is issued under a joint BSD/GNU license. You may use the 00010 * source code in this file under either license. However, note that the 00011 * complete EMAN2 and SPARX software packages have some GPL dependencies, 00012 * so you are responsible for compliance with the licenses of these packages 00013 * if you opt to use BSD licensing. The warranty disclaimer below holds 00014 * in either instance. 00015 * 00016 * This complete copyright notice must be included in any revised version of the 00017 * source code. Additional authorship citations may be added, but existing 00018 * author citations must be preserved. 00019 * 00020 * This program is free software; you can redistribute it and/or modify 00021 * it under the terms of the GNU General Public License as published by 00022 * the Free Software Foundation; either version 2 of the License, or 00023 * (at your option) any later version. 00024 * 00025 * This program is distributed in the hope that it will be useful, 00026 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00027 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00028 * GNU General Public License for more details. 00029 * 00030 * You should have received a copy of the GNU General Public License 00031 * along with this program; if not, write to the Free Software 00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00033 * 00034 * */ 00035 00036 #ifdef EMAN2_USING_OPENGL 00037 00038 //#include "emdata.h" 00039 // 00040 //#ifndef _WIN32 00041 // #ifndef GL_GLEXT_PROTOTYPES 00042 // #define GL_GLEXT_PROTOTYPES 00043 // #endif //GL_GLEXT_PROTOTYPES 00044 //#endif //_WIN32 00045 // 00046 //#ifdef __APPLE__ 00047 // #include "OpenGL/gl.h" 00048 // #include "OpenGL/glu.h" 00049 // #include "OpenGL/glext.h" 00050 //#else // WIN32, LINUX 00051 // #include "GL/gl.h" 00052 // #include "GL/glu.h" 00053 // #include "GL/glext.h" 00054 //#endif //__APPLE__ 00055 // 00056 //using namespace EMAN; 00057 // 00058 //unsigned int EMData::gen_glu_mipmaps() const 00059 //{ 00060 // if ( get_data() == 0 ) throw NullPointerException("Error, attempt to create an OpenGL mipmap without internally stored data"); 00061 // ENTERFUNC; 00062 // 00063 // unsigned int tex_name; 00064 // glGenTextures(1, &tex_name); 00065 // 00066 // if ( ny == 1 && nz == 1 ) 00067 // { 00068 // glBindTexture(GL_TEXTURE_1D, tex_name); 00069 // gluBuild1DMipmaps(GL_TEXTURE_1D, GL_LUMINANCE, nx, GL_LUMINANCE, GL_FLOAT, (void*)get_data()); 00070 // } else if (nz == 1) { 00071 // glBindTexture(GL_TEXTURE_2D, tex_name); 00072 // gluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE, nx, ny, GL_LUMINANCE, GL_FLOAT, (void*)get_data()); 00073 // } 00074 // else { 00075 //#ifdef _WIN32 00076 // //There is no gluBuild3DMipmaps() function in glu.h for VS2003 and VS2005 00077 // printf("3D OpenGL mipmaps are not available on this platform.\n"); 00078 //#else 00079 // glBindTexture(GL_TEXTURE_3D, tex_name); 00080 // gluBuild3DMipmaps(GL_TEXTURE_3D, GL_LUMINANCE, nx, ny, nz, GL_LUMINANCE, GL_FLOAT, (void*)get_data()); 00081 //#endif //_WIN32 00082 // } 00083 // 00084 // EXITFUNC; 00085 // return tex_name; 00086 //} 00087 // 00088 //unsigned int EMData::gen_gl_texture() const 00089 //{ 00090 // if ( get_data() == 0 ) throw NullPointerException("Error, attempt to create an OpenGL texture without internally stored data"); 00091 // ENTERFUNC; 00092 // 00093 // unsigned int tex_name; 00094 // glGenTextures(1, &tex_name); 00095 // 00096 // if ( ny == 1 && nz == 1 ) 00097 // { 00098 // glBindTexture(GL_TEXTURE_1D, tex_name); 00099 // glTexImage1D(GL_TEXTURE_1D,0,GL_LUMINANCE,nx,0,GL_LUMINANCE, GL_FLOAT, (void*)get_data()); 00100 // } else if (nz == 1) { 00101 // glBindTexture(GL_TEXTURE_2D, tex_name); 00102 // glTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE,nx,ny,0,GL_LUMINANCE, GL_FLOAT, (void*)get_data()); 00103 // } 00104 // else { 00105 // glBindTexture(GL_TEXTURE_3D, tex_name); 00106 //#ifdef _WIN32 00107 // PFNGLTEXIMAGE3DPROC glTexImage3D; 00108 //#endif 00109 // glTexImage3D(GL_TEXTURE_3D,0, GL_LUMINANCE,nx,ny,nz,0,GL_LUMINANCE, GL_FLOAT, (void*)get_data()); 00110 // } 00111 // 00112 // EXITFUNC; 00113 // return tex_name; 00114 //} 00115 // 00121 // 00122 // 00123 //unsigned int EMData::render_amp8_gl_texture(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) { 00124 // 00125 // string pixels = render_amp8(x0, y0, ixsize,iysize, bpl, scale, mingray, maxgray, render_min, render_max, gamma,flags); 00126 // 00127 // unsigned int tex_name; 00128 // glGenTextures(1, &tex_name); 00129 // 00130 // glBindTexture(GL_TEXTURE_2D,tex_name); 00131 // glTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE,ixsize,iysize,0,GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels.c_str() ); 00132 // 00133 // return tex_name; 00134 //} 00135 // 00137 //#ifdef GL_GLEXT_PROTOTYPES 00138 //#undef GL_GLEXT_PROTOTYPES 00139 //#endif 00140 00141 #endif // EMAN2_USING_OPENGL