14 GLRenderer::GLRenderer() {
16 iBackBone = iColorise = 0;
18 iDisplayBases = iBaseMode = 0;
19 iBaseHelix = iBaseUnpairHelix = iBaseNonHelix = 0;
20 iShapeHelix = iShapeUnpairHelix = iShapeNonHelix = 0;
21 iDisplayHelix = iHelixMidPoint = iHelixBackBone = iHelixNrs = 0;
28 iMapSpecies = iMapSpeciesBase = iMapSpeciesPos = 0;
29 iMapSpeciesDels = iMapSpeciesMiss = 0;
30 iMapSpeciesIns = iMapSpeciesInsInfo = 0;
32 G =
new OpenGLGraphics;
35 GLRenderer::~GLRenderer() {
38 void GLRenderer::DisplayHelices() {
40 glLineWidth(fHelixSize);
41 for (
int i = iStartHelix; i <= iEndHelix; i++) {
49 void GLRenderer::DisplayHelixBackBone() {
53 glPushAttrib(GL_LIST_BIT);
60 for (
int i = 1; i <= 101; i++) {
67 for (
int i = 1; i <= 5; i++) {
74 for (
int i = 1; i <= 50; i++) {
85 void GLRenderer::DisplayBasePositions() {
95 void GLRenderer::DisplayMappedSpInsertions() {
104 void GLRenderer::DisplayMappedSpBasePositions() {
113 void GLRenderer::DisplayHelixMidPoints(Texture2D *cImages) {
114 glPointSize(fHelixSize + 5);
115 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CIRCLE]);
120 void GLRenderer::DisplayHelixNumbers() {
125 void GLRenderer::DoHelixMapping() {
128 DisplayHelixNumbers();
130 if (iHelixBackBone) {
131 DisplayHelixBackBone();
137 glLineWidth(fHelixSize + 1);
145 void GLRenderer::DisplayMoleculeName(
int ,
int ,
Structure3D *cStr) {
152 pSpeciesName = (
char *)
"Eschericia Coli : Master Template";
155 float x,
y, z; x=1.1; y=z=1.0;
160 G->PrintString(x, y, z, pSpeciesName, GLUT_BITMAP_8_BY_13);
165 sprintf(buf,
"Mutations = %d", cStr->
iTotalSubs);
166 G->PrintString(x, (y-(1*line)), z, buf, GLUT_BITMAP_8_BY_13);
167 sprintf(buf,
"Deletions = %d", cStr->
iTotalDels);
168 G->PrintString(x, (y-(2*line)), z, buf, GLUT_BITMAP_8_BY_13);
169 sprintf(buf,
"Insertions = %d", cStr->
iTotalIns);
170 G->PrintString(x, (y-(3*line)), z, buf, GLUT_BITMAP_8_BY_13);
179 glScalef(0.5, 0.5, 0.5);
183 G->DrawBox(0, 0, w, h);
188 void GLRenderer::DisplayMolecule(
Structure3D *cStr) {
189 glLineWidth(fSkeletonSize);
200 if ((HelixOldColor == HelixNewColor) &&
201 (UnpairedHelixOldColor == UnpairedHelixNewColor) &&
202 (NonHelixOldColor == NonHelixNewColor))
207 HelixOldColor = HelixNewColor;
208 UnpairedHelixOldColor = UnpairedHelixNewColor;
209 NonHelixOldColor = NonHelixNewColor;
216 else if (iBackBone) {
222 DisplayBasePositions();
227 glLineWidth(ObjectSize/3);
231 if (iMapSpeciesIns && iMapSpeciesInsInfo) {
232 DisplayMappedSpInsertions();
234 if (iMapSpeciesPos) {
235 DisplayMappedSpBasePositions();
241 void GLRenderer::BeginTexturizer() {
242 glDisable(GL_CULL_FACE);
243 glDisable(GL_LIGHTING);
244 glDisable(GL_POINT_SMOOTH);
245 glDepthMask(GL_TRUE);
246 glEnable(GL_TEXTURE_2D);
249 glEnable(GL_ALPHA_TEST);
250 glAlphaFunc(GL_GREATER, 0.1);
252 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
254 float quadratic[] = { 0.0f, 0.0f, 1.0f };
255 glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic);
258 float maxSize = 0.0f;
259 glGetFloatv(GL_POINT_SIZE_MAX_EXT, &maxSize);
260 glPointSize(MIN(ObjectSize, maxSize));
262 glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0f);
263 glPointParameterfEXT(GL_POINT_SIZE_MAX_EXT, MIN(65, maxSize));
265 glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
266 glEnable(GL_POINT_SPRITE_ARB);
270 void GLRenderer::EndTexturizer() {
273 float defaultAttenuation[3] = { 1.0f, 0.0f, 0.0f };
274 glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, defaultAttenuation);
276 glDisable(GL_POINT_SPRITE_ARB);
278 glDisable(GL_ALPHA_TEST);
282 #define POLOFFON glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1, 1); glDepthFunc(GL_LESS)
283 #define POLOFFOFF glDepthFunc(GL_LEQUAL); glPolygonOffset(0, 0); glDisable(GL_POLYGON_OFFSET_FILL)
285 void GLRenderer::TexturizeStructure(Texture2D *cImages,
Structure3D *cStructure) {
288 glPointSize(ObjectSize*2);
290 glBindTexture(GL_TEXTURE_2D, cImages->texture[
HEXAGON]);
294 glPointSize(ObjectSize*1.5);
295 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CIRCLE]);
300 if (iDispCursorPos) {
301 glPointSize(ObjectSize+8);
303 glBindTexture(GL_TEXTURE_2D, cImages->texture[
DIAMOND]);
307 glPointSize(ObjectSize);
314 ColorRGBf& ApplicationBGColor =
G->ApplicationBGColor;
315 glColor4f(ApplicationBGColor.
red, ApplicationBGColor.
green, ApplicationBGColor.
blue, 1);
316 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CIRCLE]);
325 if (iBaseUnpairHelix) {
342 glBindTexture(GL_TEXTURE_2D, cImages->texture[
LETTER_A]);
348 if (iBaseUnpairHelix) {
358 glBindTexture(GL_TEXTURE_2D, cImages->texture[
LETTER_G]);
364 if (iBaseUnpairHelix) {
374 glBindTexture(GL_TEXTURE_2D, cImages->texture[
LETTER_C]);
380 if (iBaseUnpairHelix) {
390 glBindTexture(GL_TEXTURE_2D, cImages->texture[
LETTER_U]);
396 if (iBaseUnpairHelix) {
410 glBindTexture(GL_TEXTURE_2D, cImages->texture[iShapeHelix]);
414 if (iBaseUnpairHelix) {
415 glBindTexture(GL_TEXTURE_2D, cImages->texture[iShapeUnpairHelix]);
420 glBindTexture(GL_TEXTURE_2D, cImages->texture[iShapeNonHelix]);
428 if (iDisplayHelix && iHelixMidPoint) {
429 DisplayHelixMidPoints(cImages);
433 if (iMapSpeciesBase) {
434 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CIRCLE]);
436 glPointSize(ObjectSize+4);
441 glPointSize(ObjectSize);
446 glPointSize(ObjectSize);
454 if (iMapSpeciesMiss) {
455 glPointSize(ObjectSize);
457 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CIRCLE]);
459 glPointSize(ObjectSize-2);
461 glBindTexture(GL_TEXTURE_2D, cImages->texture[
QUESTION]);
465 if (iMapSpeciesDels) {
466 glPointSize(ObjectSize);
468 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CIRCLE]);
470 glPointSize(ObjectSize-2);
472 glBindTexture(GL_TEXTURE_2D, cImages->texture[
DANGER]);
476 if (iMapSpeciesIns) {
477 glPointSize(ObjectSize*3);
479 glBindTexture(GL_TEXTURE_2D, cImages->texture[
CONE_DOWN]);
#define AWAR_3D_SELECTED_SPECIES
static void DisplayMoleculeMask(AW_root *)
void GenerateMoleculeSkeleton()
char * read_string() const
AW_awar * awar(const char *awar)
static int FindTypeOfRNA()
bool bPointSpritesSupported