00001 #include "VSliceRenderer.h"
00002 #include "glew.h"
00003 #include "VFramebufferObject.h"
00004
00005 VSliceRenderer::VSliceRenderer() : m_ActiveSlice(ALL), m_active_saggital(1), m_active_corronal(1),
00006 m_active_transversal(1), m_ProgramLoaded(false), m_TransferFunctionHandle(0), m_tf_activated(0)
00007 {
00008 m_Volume = NULL;
00009 }
00010
00011
00012 VSliceRenderer::VSliceRenderer(VVolume * volume) : m_ActiveSlice(ALL), m_active_saggital(1),
00013 m_active_corronal(1), m_active_transversal(1), m_ProgramLoaded(false), m_TransferFunctionHandle(0)
00014 {
00015 m_Volume = volume;
00016 }
00017
00018 void VSliceRenderer::draw()
00019 {
00020 switch (m_ActiveSlice)
00021 {
00022 case SAGGITAL:
00023 this->drawSaggitalSlice();
00024 break;
00025 case CORRONAL:
00026 this->drawCorronalSlice();
00027 break;
00028 case TRANSVERSAL:
00029 this->drawTransversalSlice();
00030 break;
00031 case ALL:
00032 this->drawAllSlices();
00033 break;
00034 }
00035 }
00036
00037 void VSliceRenderer::processInput(guiInput input)
00038 {
00039
00040
00041
00042
00043 }
00044
00045 void VSliceRenderer::drawAllSlices()
00046 {
00047 glActiveTextureARB(GL_TEXTURE0_ARB);
00048 glEnable(GL_TEXTURE_3D);
00049 glBindTexture(GL_TEXTURE_3D, m_Volume->getGLVolumeHandle());
00050
00051
00052 if (m_tf_activated)
00053 {
00054
00055 glActiveTextureARB(GL_TEXTURE1_ARB);
00056 glEnable(GL_TEXTURE_2D);
00057 glBindTexture(GL_TEXTURE_2D, m_TransferFunctionHandle);
00058
00059 m_Program_with_tf.bind();
00060 glUniform1i(m_Program_with_tf.getUniformLocation("mVolume"),0);
00061 glUniform1i(m_Program_with_tf.getUniformLocation("mTransfer"),1);
00062 }
00063 else
00064 {
00065 m_Program_without_tf.bind();
00066 glUniform1i(m_Program_without_tf.getUniformLocation("mVolume"),0);
00067 }
00068
00069
00070
00071
00072 const GLenum glError = glGetError();
00073
00074 if (glError != GL_NO_ERROR)
00075 std::cout << "Error in draw " << gluErrorString(glError) << std::endl;
00076
00077 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
00078
00079
00080 glBegin(GL_QUADS);
00081
00082 float minx = 0.0f;
00083 float miny = 0.0f;
00084 float maxx = 0.0f;
00085 float maxy = 0.0f;
00086
00087 float fw = 662.0f / (float)m_Width;
00088 float fh = 662.0f / (float)m_Height;
00089
00090 float w0, h0;
00091 float aspect = ((float)m_Volume->getDimX()/(float)m_Volume->getDimZ());
00092
00093 if(aspect < 1.0f)
00094 {
00095 h0 = 0.5f;
00096 w0 = 0.5f * aspect;
00097 }
00098 else
00099 {
00100 w0 = 0.5f;
00101 h0 = 0.5f / aspect;
00102 }
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195 if (fw > fh)
00196 {
00197 h0 /= fw;
00198 h0 *= fh;
00199
00200 }else
00201 {
00202 w0 /= fh;
00203 w0 *= fw;
00204 }
00205
00206 minx = -0.5f - w0;
00207 maxx = -0.5f + w0;
00208 miny = -0.5f - h0;
00209 maxy = -0.5f + h0;
00210
00211
00212
00213
00214 glTexCoord3f(0.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 0.0f);
00215 glVertex3f(minx, miny, 0.0f);
00216
00217
00218 glTexCoord3f(0.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 1.0f);
00219 glVertex3f(minx, maxy, 0.0f);
00220
00221
00222 glTexCoord3f(1.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 1.0f);
00223 glVertex3f(maxx, maxy, 0.0f);
00224
00225
00226 glTexCoord3f(1.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 0.0f);
00227 glVertex3f(maxx, miny, 0.0f);
00228 glEnd();
00229
00230
00231 glBegin(GL_QUADS);
00232
00233
00234 aspect = ((float)m_Volume->getDimY()/(float)m_Volume->getDimZ());
00235 if(aspect < 1.0f)
00236 {
00237 h0 = 0.5f;
00238 w0 = 0.5f * aspect;
00239 }
00240 else
00241 {
00242 w0 = 0.5f;
00243 h0 = 0.5f / aspect;
00244 }
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337 if (fw > fh)
00338 {
00339 h0 /= fw;
00340 h0 *= fh;
00341
00342 }else
00343 {
00344 w0 /= fh;
00345 w0 *= fw;
00346 }
00347
00348 minx = -0.5f - w0;
00349 maxx = -0.5f + w0;
00350 miny = 0.5f - h0;
00351 maxy = 0.5f + h0;
00352
00353 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 0.0f, 0.0f);
00354 glVertex3f(minx, miny, 0.0f);
00355
00356 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 0.0f, 1.0f);
00357 glVertex3f(minx, maxy, 0.0f);
00358
00359 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 1.0f, 1.0f);
00360 glVertex3f(maxx, maxy, 0.0f);
00361
00362 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 1.0f, 0.0f);
00363 glVertex3f(maxx, miny, 0.0f);
00364 glEnd();
00365
00366
00367
00368 glBegin(GL_QUADS);
00369 aspect = ((float)m_Volume->getDimY()/(float)m_Volume->getDimX());
00370
00371 if(aspect < 1.0f)
00372 {
00373 h0 = 0.5f;
00374 w0 = 0.5f * aspect;
00375 }
00376 else
00377 {
00378 w0 = 0.5f;
00379 h0 = 0.5f / aspect;
00380 }
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473 if (fw > fh)
00474 {
00475 h0 /= fw;
00476 h0 *= fh;
00477
00478 }else
00479 {
00480 w0 /= fh;
00481 w0 *= fw;
00482 }
00483
00484 minx = 0.5f - w0;
00485 maxx = 0.5f + w0;
00486 miny = 0.5f - h0;
00487 maxy = 0.5f + h0;
00488
00489 glTexCoord3f(0.0f, 0.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00490 glVertex3f(minx, miny, 0.0f);
00491
00492 glTexCoord3f(0.0f, 1.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00493 glVertex3f(minx, maxy, 0.0f);
00494
00495 glTexCoord3f(1.0f, 1.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00496 glVertex3f(maxx, maxy, 0.0f);
00497
00498 glTexCoord3f(1.0f, 0.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00499 glVertex3f(maxx, miny, 0.0f);
00500 glEnd();
00501
00502 if(m_tf_activated)
00503 {
00504 m_Program_with_tf.release();
00505
00506 glActiveTextureARB(GL_TEXTURE1_ARB);
00507 glBindTexture(GL_TEXTURE_2D, 0);
00508 glDisable(GL_TEXTURE_2D);
00509 }
00510 else
00511 {
00512 m_Program_without_tf.release();
00513 }
00514
00515
00516 glActiveTextureARB(GL_TEXTURE0_ARB);
00517 glBindTexture(GL_TEXTURE_3D, 0);
00518 glDisable(GL_TEXTURE_3D);
00519
00520 glBegin(GL_LINES);
00521 glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
00522 glVertex3f(0.0f, 1.0f, -1.0f);
00523
00524 glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
00525 glVertex3f(0.0f, -1.0f, -1.0f);
00526
00527 glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
00528 glVertex3f(1.0f, 0.0f, -1.0f);
00529
00530 glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
00531 glVertex3f(-1.0f, 0.0f, -1.0f);
00532 glEnd();
00533 }
00534
00535 void VSliceRenderer::drawCorronalSlice()
00536 {
00537 glActiveTextureARB(GL_TEXTURE0_ARB);
00538 glEnable(GL_TEXTURE_3D);
00539 glBindTexture(GL_TEXTURE_3D, m_Volume->getGLVolumeHandle());
00540
00541
00542 if (m_tf_activated)
00543 {
00544
00545 glActiveTextureARB(GL_TEXTURE1_ARB);
00546 glEnable(GL_TEXTURE_2D);
00547 glBindTexture(GL_TEXTURE_2D, m_TransferFunctionHandle);
00548
00549 m_Program_with_tf.bind();
00550 glUniform1i(m_Program_with_tf.getUniformLocation("mVolume"),0);
00551 glUniform1i(m_Program_with_tf.getUniformLocation("mTransfer"),1);
00552 }
00553 else
00554 {
00555 m_Program_without_tf.bind();
00556 glUniform1i(m_Program_without_tf.getUniformLocation("mVolume"),0);
00557 }
00558
00559 float windowaspect = (float)m_Width / (float) m_Height;
00560
00561 float minx = -1.0f;
00562 float miny = -1.0f;
00563 float maxx = 1.0f;
00564 float maxy = 1.0f;
00565 float xsize;
00566 float ysize;
00567
00568 float aspect = ((float)m_Volume->getDimX()/(float)m_Volume->getDimZ());
00569
00570
00571 if(windowaspect > 1.0f)
00572 {
00573
00574 minx += (1.0f - (1.0f/windowaspect))/2.0f;
00575 maxx -= (1.0f - (1.0f/windowaspect))/2.0f;
00576 }
00577 else if (windowaspect < 1.0f)
00578 {
00579
00580 miny += (1.0f - (windowaspect/1.0f))/2.0f;
00581 maxy -= (1.0f - (windowaspect/1.0f))/2.0f;
00582 }
00583
00584 xsize = abs(minx) + abs(maxx);
00585 ysize = abs(miny) + abs(maxy);
00586
00587 if(aspect > 1.0f)
00588 {
00589
00590
00591
00592 miny /= aspect;
00593 maxy /= aspect;
00594
00595 if(windowaspect >= 1.0f)
00596 {
00597 minx /= xsize/2.0f;
00598 maxx /= xsize/2.0f;
00599
00600 miny /= xsize/2.0f;
00601 maxy /= xsize/2.0f;
00602 }
00603 else
00604 {
00605 minx /= xsize/2.0f;
00606 maxx /= xsize/2.0f;
00607
00608 miny *= ysize/2.0f;
00609 maxy *= ysize/2.0f;
00610 }
00611
00612
00613 if((miny < -1.0f) && (maxy > 1.0f))
00614 {
00615 float smax = maxy;
00616
00617 minx /= smax;
00618 miny /= smax;
00619
00620 maxx /= smax;
00621 maxy /= smax;
00622 }
00623 }
00624 else if(aspect < 1.0f)
00625 {
00626
00627
00628 minx *= aspect;
00629 maxx *= aspect;
00630
00631 if(windowaspect >= 1.0f)
00632 {
00633 minx *= xsize/2.0f;
00634 maxx *= xsize/2.0f;
00635
00636 miny /= ysize/2.0f;
00637 maxy /= ysize/2.0f;
00638 }
00639 else
00640 {
00641 minx /= ysize/2.0f;
00642 maxx /= ysize/2.0f;
00643
00644 miny /= ysize/2.0f;
00645 maxy /= ysize/2.0f;
00646 }
00647
00648 if((minx < -1.0f) && (maxx > 1.0f))
00649 {
00650 float smax = maxx;
00651
00652 minx /= smax;
00653 miny /= smax;
00654
00655 maxx /= smax;
00656 maxy /= smax;
00657 }
00658 }
00659
00660 glBegin(GL_QUADS);
00661 glTexCoord3f(0.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 0.0f);
00662 glVertex3f(minx, miny, 0.0f);
00663
00664 glTexCoord3f(0.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 1.0f);
00665 glVertex3f(minx, maxy, 0.0f);
00666
00667 glTexCoord3f(1.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 1.0f);
00668 glVertex3f(maxx, maxy, 0.0f);
00669
00670 glTexCoord3f(1.0f, (float)(m_active_corronal - 1)/(float)m_Volume->getDimY(), 0.0f);
00671 glVertex3f(maxx, miny, 0.0f);
00672 glEnd();
00673
00674 if(m_tf_activated)
00675 {
00676 m_Program_with_tf.release();
00677
00678 glActiveTextureARB(GL_TEXTURE1_ARB);
00679 glBindTexture(GL_TEXTURE_2D, 0);
00680 glDisable(GL_TEXTURE_2D);
00681 }
00682 else
00683 {
00684 m_Program_without_tf.release();
00685 }
00686
00687
00688 glActiveTextureARB(GL_TEXTURE0_ARB);
00689 glBindTexture(GL_TEXTURE_3D, 0);
00690 glDisable(GL_TEXTURE_3D);
00691 }
00692
00693 void VSliceRenderer::drawSaggitalSlice()
00694 {
00695 glActiveTextureARB(GL_TEXTURE0_ARB);
00696 glEnable(GL_TEXTURE_3D);
00697 glBindTexture(GL_TEXTURE_3D, m_Volume->getGLVolumeHandle());
00698
00699
00700 if (m_tf_activated)
00701 {
00702
00703 glActiveTextureARB(GL_TEXTURE1_ARB);
00704 glEnable(GL_TEXTURE_2D);
00705 glBindTexture(GL_TEXTURE_2D, m_TransferFunctionHandle);
00706
00707 m_Program_with_tf.bind();
00708 glUniform1i(m_Program_with_tf.getUniformLocation("mVolume"),0);
00709 glUniform1i(m_Program_with_tf.getUniformLocation("mTransfer"),1);
00710 }
00711 else
00712 {
00713 m_Program_without_tf.bind();
00714 glUniform1i(m_Program_without_tf.getUniformLocation("mVolume"),0);
00715 }
00716
00717 float windowaspect = (float)m_Width / (float) m_Height;
00718
00719 float aspect = ((float)m_Volume->getDimY()/(float)m_Volume->getDimZ());
00720 float minx = -1.0f;
00721 float miny = -1.0f;
00722 float maxx = 1.0f;
00723 float maxy = 1.0f;
00724 float xsize;
00725 float ysize;
00726
00727 if(windowaspect > 1.0f)
00728 {
00729
00730 minx += (1.0f - (1.0f/windowaspect))/2.0f;
00731 maxx -= (1.0f - (1.0f/windowaspect))/2.0f;
00732 }
00733 else if (windowaspect < 1.0f)
00734 {
00735
00736 miny += (1.0f - (windowaspect/1.0f))/2.0f;
00737 maxy -= (1.0f - (windowaspect/1.0f))/2.0f;
00738 }
00739
00740 xsize = abs(minx) + abs(maxx);
00741 ysize = abs(miny) + abs(maxy);
00742
00743 if(aspect > 1.0f)
00744 {
00745
00746
00747
00748 miny /= aspect;
00749 maxy /= aspect;
00750
00751 if(windowaspect >= 1.0f)
00752 {
00753 minx /= xsize/2.0f;
00754 maxx /= xsize/2.0f;
00755
00756 miny /= xsize/2.0f;
00757 maxy /= xsize/2.0f;
00758 }
00759 else
00760 {
00761 minx /= xsize/2.0f;
00762 maxx /= xsize/2.0f;
00763
00764 miny *= ysize/2.0f;
00765 maxy *= ysize/2.0f;
00766 }
00767
00768
00769 if((miny < -1.0f) && (maxy > 1.0f))
00770 {
00771 float smax = maxy;
00772
00773 minx /= smax;
00774 miny /= smax;
00775
00776 maxx /= smax;
00777 maxy /= smax;
00778 }
00779 }
00780 else if(aspect < 1.0f)
00781 {
00782
00783
00784 minx *= aspect;
00785 maxx *= aspect;
00786
00787 if(windowaspect >= 1.0f)
00788 {
00789 minx *= xsize/2.0f;
00790 maxx *= xsize/2.0f;
00791
00792 miny /= ysize/2.0f;
00793 maxy /= ysize/2.0f;
00794 }
00795 else
00796 {
00797 minx /= ysize/2.0f;
00798 maxx /= ysize/2.0f;
00799
00800 miny /= ysize/2.0f;
00801 maxy /= ysize/2.0f;
00802 }
00803
00804 if((minx < -1.0f) && (maxx > 1.0f))
00805 {
00806 float smax = maxx;
00807
00808 minx /= smax;
00809 miny /= smax;
00810
00811 maxx /= smax;
00812 maxy /= smax;
00813 }
00814 }
00815
00816 glBegin(GL_QUADS);
00817 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 0.0f, 0.0f);
00818 glVertex3f(minx, miny, 0.0f);
00819
00820 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 0.0f, 1.0f);
00821 glVertex3f(minx, maxy, 0.0f);
00822
00823 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 1.0f, 1.0f);
00824 glVertex3f(maxx, maxy, 0.0f);
00825
00826 glTexCoord3f((float)(m_active_saggital-1)/(float)m_Volume->getDimX(), 1.0f, 0.0f);
00827 glVertex3f(maxx, miny, 0.0f);
00828 glEnd();
00829
00830 if(m_tf_activated)
00831 {
00832 m_Program_with_tf.release();
00833
00834 glActiveTextureARB(GL_TEXTURE1_ARB);
00835 glBindTexture(GL_TEXTURE_2D, 0);
00836 glDisable(GL_TEXTURE_2D);
00837 }
00838 else
00839 {
00840 m_Program_without_tf.release();
00841 }
00842
00843
00844 glActiveTextureARB(GL_TEXTURE0_ARB);
00845 glBindTexture(GL_TEXTURE_3D, 0);
00846 glDisable(GL_TEXTURE_3D);
00847 }
00848
00849 void VSliceRenderer::drawTransversalSlice()
00850 {
00851 glActiveTextureARB(GL_TEXTURE0_ARB);
00852 glEnable(GL_TEXTURE_3D);
00853 glBindTexture(GL_TEXTURE_3D, m_Volume->getGLVolumeHandle());
00854
00855
00856 if (m_tf_activated)
00857 {
00858
00859 glActiveTextureARB(GL_TEXTURE1_ARB);
00860 glEnable(GL_TEXTURE_2D);
00861 glBindTexture(GL_TEXTURE_2D, m_TransferFunctionHandle);
00862
00863 m_Program_with_tf.bind();
00864 glUniform1i(m_Program_with_tf.getUniformLocation("mVolume"),0);
00865 glUniform1i(m_Program_with_tf.getUniformLocation("mTransfer"),1);
00866 }
00867 else
00868 {
00869 m_Program_without_tf.bind();
00870 glUniform1i(m_Program_without_tf.getUniformLocation("mVolume"),0);
00871 }
00872
00873 float windowaspect = (float)m_Width / (float) m_Height;
00874
00875
00876 float aspect = ((float)m_Volume->getDimY()/(float)m_Volume->getDimX());
00877 float minx = -1.0f;
00878 float miny = -1.0f;
00879 float maxx = 1.0f;
00880 float maxy = 1.0f;
00881 float xsize;
00882 float ysize;
00883
00884 if(windowaspect > 1.0f)
00885 {
00886
00887 minx += (1.0f - (1.0f/windowaspect))/2.0f;
00888 maxx -= (1.0f - (1.0f/windowaspect))/2.0f;
00889 }
00890 else if (windowaspect < 1.0f)
00891 {
00892
00893 miny += (1.0f - (windowaspect/1.0f))/2.0f;
00894 maxy -= (1.0f - (windowaspect/1.0f))/2.0f;
00895 }
00896
00897 xsize = abs(minx) + abs(maxx);
00898 ysize = abs(miny) + abs(maxy);
00899
00900 if(aspect > 1.0f)
00901 {
00902
00903
00904
00905 miny /= aspect;
00906 maxy /= aspect;
00907
00908 if(windowaspect >= 1.0f)
00909 {
00910 minx /= xsize/2.0f;
00911 maxx /= xsize/2.0f;
00912
00913 miny /= xsize/2.0f;
00914 maxy /= xsize/2.0f;
00915 }
00916 else
00917 {
00918 minx /= xsize/2.0f;
00919 maxx /= xsize/2.0f;
00920
00921 miny *= ysize/2.0f;
00922 maxy *= ysize/2.0f;
00923 }
00924
00925
00926 if((miny < -1.0f) && (maxy > 1.0f))
00927 {
00928 float smax = maxy;
00929
00930 minx /= smax;
00931 miny /= smax;
00932
00933 maxx /= smax;
00934 maxy /= smax;
00935 }
00936 }
00937 else if(aspect < 1.0f)
00938 {
00939
00940
00941 minx *= aspect;
00942 maxx *= aspect;
00943
00944 if(windowaspect >= 1.0f)
00945 {
00946 minx *= xsize/2.0f;
00947 maxx *= xsize/2.0f;
00948
00949 miny /= ysize/2.0f;
00950 maxy /= ysize/2.0f;
00951 }
00952 else
00953 {
00954 minx /= ysize/2.0f;
00955 maxx /= ysize/2.0f;
00956
00957 miny /= ysize/2.0f;
00958 maxy /= ysize/2.0f;
00959 }
00960
00961 if((minx < -1.0f) && (maxx > 1.0f))
00962 {
00963 float smax = maxx;
00964
00965 minx /= smax;
00966 miny /= smax;
00967
00968 maxx /= smax;
00969 maxy /= smax;
00970 }
00971 }
00972
00973 glBegin(GL_QUADS);
00974 glTexCoord3f(0.0f, 0.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00975 glVertex3f(minx, miny, 0.0f);
00976
00977 glTexCoord3f(0.0f, 1.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00978 glVertex3f(minx, maxy, 0.0f);
00979
00980 glTexCoord3f(1.0f, 1.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00981 glVertex3f(maxx, maxy, 0.0f);
00982
00983 glTexCoord3f(1.0f, 0.0f, (float)(m_active_transversal-1)/(float)m_Volume->getDimZ());
00984 glVertex3f(maxx, miny, 0.0f);
00985 glEnd();
00986
00987 if(m_tf_activated)
00988 {
00989 m_Program_with_tf.release();
00990
00991 glActiveTextureARB(GL_TEXTURE1_ARB);
00992 glBindTexture(GL_TEXTURE_2D, 0);
00993 glDisable(GL_TEXTURE_2D);
00994 }
00995 else
00996 {
00997 m_Program_without_tf.release();
00998 }
00999
01000
01001 glActiveTextureARB(GL_TEXTURE0_ARB);
01002 glBindTexture(GL_TEXTURE_3D, 0);
01003 glDisable(GL_TEXTURE_3D);
01004 }