arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

VolSamples.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     10-11-02
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2002 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 // VolSamples.cpp
00019 
00020 
00021 #include <GL/glew.h>
00022 #include "VolSamples.h"
00023 #include <iostream>
00024 using namespace std;
00025 
00026 VolSamples::VolSamples(unsigned int size, 
00027                        unsigned int nTcoords)
00028 : VSPRIM(GL_TRIANGLES, size, size, nTcoords, size, false, false, false, false)
00029 {
00030 
00031 }
00032 
00033 #if 0
00034 void VolSamples::bindDef()
00035 {
00036    glVertexPointer(3, GL_FLOAT, 0, _verts.data());
00037    glEnableClientState(GL_VERTEX_ARRAY); 
00038 
00039    for(int i=0; i<NTEXCOORDS; ++i)
00040    {
00041       if(_texCoordEnabled[i])
00042       {
00043          glClientActiveTexture(GL_TEXTURE0_ARB + i);
00044          {
00045             glTexCoordPointer(4, GL_FLOAT, 0, _tcoords[i].data());
00046             glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
00047          }
00048       }
00049    }
00050    glClientActiveTexture(GL_TEXTURE0_ARB);
00051 
00052    if(_optimize)
00053       glLockArraysEXT(0, _verts.size());
00054 }
00055 
00056 void VolSamples::releaseDef()
00057 {
00058    if(_optimize)
00059       glUnlockArraysEXT();
00060 
00061    glDisableClientState(GL_VERTEX_ARRAY); 
00062 
00063    for(int i=0; i<NTEXCOORDS; ++i)
00064    {
00065       glClientActiveTexture(GL_TEXTURE0_ARB + i);
00066       {
00067          glDisableClientState(GL_TEXTURE_COORD_ARRAY); 
00068       }
00069    }
00070    glClientActiveTexture(GL_TEXTURE0_ARB);
00071 }
00072 
00073 void VolSamples::drawAll()
00074 {
00075    glDrawElements(GL_TRIANGLES, 
00076       _nTris*3, 
00077       GL_UNSIGNED_INT, 
00078       _idx.data());
00079 }
00080 
00081 void VolSamples::draw(int primId)
00082 {
00083    glDrawElements(GL_TRIANGLES, 
00084       (_prims[primId].y - _prims[primId].x)*3, 
00085       GL_UNSIGNED_INT, 
00086       _idx[_prims[primId].x].v());
00087 }
00088 
00089 #endif
00090 

Send questions, comments, and bug reports to:
jmk