17 #include <GL/aw_window_ogl.hxx>
109 const GLubyte *vendor =
NULp;
110 vendor = glGetString(GL_VENDOR); cout<<
"Vendor : "<<vendor<<endl;
111 vendor = glGetString(GL_RENDERER); cout<<
"Renderer: "<<vendor<<endl;
112 vendor = glGetString(GL_VERSION); cout<<
"Version : "<<vendor<<endl;
117 char missingExtensions[500]=
"";
118 if (!GLEW_VERSION_1_2) {
119 strcat(missingExtensions,
"\nOpenGL Version 1.2");
121 if (strlen(missingExtensions) > 0) {
122 GBK_terminatef(
"ERROR: Some needed extensions are not present:%s\n", missingExtensions);
126 printf(
"DEBUG: All mandatory extensions seem to be ok.\n");
130 missingExtensions[0] = 0;
131 if (!GLEW_EXT_point_parameters) strcat(missingExtensions,
"\nGL_EXT_point_parameters");
132 if (!GLEW_ARB_point_sprite) strcat(missingExtensions,
"\nGL_ARB_point_sprite");
133 if (strlen(missingExtensions) > 0) {
134 printf(
"Some extra extensions are not present:%s\n", missingExtensions);
135 printf(
"Molecule Display: Quality of Rendering is LOW!!\n");
140 printf(
"DEBUG: All extra extensions seem to be ok as well.\n");
147 iScreenWidth = width;
148 iScreenHeight = height;
152 glViewport(0, 0, width, height);
153 glMatrixMode(GL_PROJECTION);
156 glMatrixMode(GL_MODELVIEW);
162 GLfloat new_rotation_matrix[16];
167 glRotatef(-
rot_x, 1.0, 0.0, 0.0);
168 glRotatef(
rot_y, 0.0, 1.0, 0.0);
169 glGetFloatv(GL_MODELVIEW_MATRIX, new_rotation_matrix);
175 glMultMatrixf(new_rotation_matrix);
186 cout<<
"RNA3D: Initializing OpenGLEngine : "<<width<<
" x "<<height<<endl;
194 GLenum err = glewInit();
195 if (GLEW_OK != err) {
197 fprintf(stderr,
"Error: %s\n", glewGetErrorString(err));
199 fprintf(stdout,
"Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
214 glShadeModel(GL_SMOOTH);
215 glClearColor(0, 0, 0, 1);
218 glEnable(GL_DEPTH_TEST);
219 glDepthFunc(GL_LEQUAL);
221 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
222 glEnable(GL_TEXTURE_2D);
238 GLRenderer *cRenderer = RNA3D->
cRenderer;
248 GLRenderer *cRenderer = RNA3D->
cRenderer;
299 cout<<
"WARNING: Invalid POSITION Interval!! Setting it to Default Value (25)."<<endl;
404 if (upper_limit_changed) {
423 GLRenderer *cRenderer = RNA3D->
cRenderer;
426 cRenderer->DisplayMolecule(RNA3D->
cStructure);
429 cRenderer->DoHelixMapping();
432 cRenderer->BeginTexturizer();
434 cRenderer->EndTexturizer();
438 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
441 RNA3D->
cGraphics->SetOpenGLBackGroundColor();
455 RNA3D->
cRenderer->DisplayMoleculeMask(iScreenWidth, iScreenHeight);
464 glTranslatef(-strCen.
x, -strCen.
y, -strCen.
z);
470 glXSwapBuffers (XtDisplay(w), XtWindow(w));
481 XtGetValues(w, args, 1);
485 fprintf(stderr,
"could not open display\n");
489 vi = glXChooseVisual(
dpy, DefaultScreen(
dpy), DoubleBufferWithAlpha);
490 printf(
"RNA3D: Double Buffered Visual With Alpha Size Supported !\n");
493 vi = glXChooseVisual(
dpy, DefaultScreen(
dpy), DoubleBuffer);
494 printf(
"RNA3D: Double Buffered Visual Supported !\n");
498 fprintf(stderr,
"try to get a single buffered visual\n");
499 vi = glXChooseVisual(
dpy, DefaultScreen(
dpy), SingleBuffer);
501 fprintf(stderr,
"could not get visual\n");
506 fprintf(stderr,
"direct rendering not supported\n");
508 printf(
"RNA3D: Direct rendering supported\n");
517 char fontName[] =
"fixed";
518 RNA3D->
cGraphics->InitMainFont(fontName);
#define AWAR_3D_MAP_SEARCH_STRINGS
void CursorPositionChanged_CB(AW_root *awr)
static void update_HelixNrDispList()
static bool bHelixNrDispListCreated
#define AWAR_3D_SHAPES_UNPAIRED_HELIX
#define AWAR_3D_MOL_BACKBONE
static bool bMapSpDispListCreated
void GenerateDisplayLists()
#define AWAR_3D_MAP_SPECIES_DISP_BASE
void MapSearchStringsToEcoliTemplate(AW_root *awr)
#define AWAR_CURSOR_POSITION
static int SingleBuffer[]
#define AWAR_3D_MOL_ROTATE
void GLwDrawingAreaMakeCurrent(Widget w, GLXContext ctx)
bool AW_alpha_Size_Supported
void RefreshOpenGLDisplay()
void ReshapeOpenGLWindow(GLint width, GLint height)
#define AWAR_3D_MAP_SPECIES
static GLXContext glx_context
void DisplayPostionsIntervalChanged_CB(AW_root *awr)
void GBK_terminatef(const char *templat,...)
#define AWAR_3D_MOL_COLORIZE
#define AWAR_3D_HELIX_FROM
#define AWAR_3D_MAP_SPECIES_DISP_POS
void GenerateHelixNrDispList(int startHx, int endHx)
#define AWAR_3D_CURSOR_POSITION
void MapCurrentSpeciesToEcoliTemplate(AW_root *awr)
static void initExtensions()
#define AWAR_3D_SHAPES_HELIX
bool bEColiRefInitialized
#define AWAR_3D_MAP_SPECIES_DISP_MISSING
void ReadCoOrdinateFile()
#define AWAR_3D_DISPLAY_TERTIARY_INTRACTIONS
#define AWAR_3D_MAP_ENABLE
int abs_2_rel(int abs) const
static int DoubleBufferWithAlpha[]
#define AWAR_3D_MAP_SPECIES_DISP_INSERTIONS
#define AWAR_3D_BASES_HELIX
#define AWAR_3D_DISPLAY_HELIX
CONSTEXPR_INLINE const T & force_in_range(const T &lower_bound, const T &value, const T &upper_bound)
static void CalculateRotationMatrix()
void MapSelectedSpeciesChanged_CB(AW_root *awr)
#define AWAR_3D_BASES_NON_HELIX
#define AWAR_3D_DISPLAY_BASES
#define AWAR_3D_MOL_POS_INTERVAL
bool bMapSearchStringsDispListCreated
void InitializeOpenGLWindow(Widget w)
#define AWAR_3D_MAP_SPECIES_DISP_INSERTIONS_INFO
static GLfloat rotation_matrix[16]
#define AWAR_3D_MAP_SPECIES_DISP_DELETIONS
bool bMapSaiDispListCreated
void GenerateCursorPositionDispList(long pos)
AW_awar * awar(const char *awar)
#define AWAR_3D_HELIX_NUMBER
#define AWAR_3D_HELIX_MIDPOINT
void ComputeRotationXY(int x, int y)
#define AWAR_3D_MOL_DISP_POS
static void DrawStructure()
void RNA3D_init_global_data(ED4_plugin_host &host)
void DisplayHelixNrsChanged_CB(AW_root *awr, bool upper_limit_changed)
#define AWAR_3D_DISPLAY_SIZE
void MapSaiToEcoliTemplate()
void MapSaiToEcoliTemplateChanged_CB(AW_root *)
void InitializeOpenGLEngine(GLint width, GLint height)
#define AWAR_3D_SHAPES_NON_HELIX
void MapSearchStringsToEcoliTemplateChanged_CB(AW_root *awr)
#define AWAR_3D_HELIX_SIZE
void RenderOpenGLScene(Widget w)
static int DoubleBuffer[]
#define AWAR_3D_BASES_UNPAIRED_HELIX
RNA3D_Global(ED4_plugin_host &host)
void MapDisplayParameters(AW_root *root)
static void ShowVendorInformation()
bool bPointSpritesSupported
void ComputeBasePositions()
void GetSecondaryStructureInfo()
#define AWAR_3D_HELIX_BACKBONE
OpenGLGraphics * cGraphics
void Combine2Dand3DstructureInfo()
static bool bCursorPosDispListCreated
GB_ERROR write_int(long aw_int)
struct _WidgetRec * Widget
static float fAspectRatio
#define AWAR_3D_BASES_MODE