Page principale Liste des namespaces Hiérarchie des classes Liste par ordre alphabétique Liste des composants Liste des fichiers Membres des namespaces Composants Déclarations

# ExManagerVertexArrays.cpp

Aller à la documentation de ce fichier.

    00001 /*
    00002  * ExNihilo 3D Engine
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  *
    00018  * Please read AUTHORS file !!!
    00019  *
    00020
    00021  *
    00022  */
    00023 #include "ExManagerVertexArrays.h"
    00024
    00025 bool ExManagerVertexArrays::m_flag = false;
    00026 ExManagerVertexArrays* ExManagerVertexArrays::m_instance = NULL;
    00027
    00028 ExManagerVertexArrays* ExManagerVertexArrays::CreateSingleton(void){
    00029 Guard(ExManagerVertexArrays* ExManagerVertexArrays::CreateSingleton(void))
    00030         if(!m_flag)
    00031         {
    00032                 m_flag = true; // We are creating the error log now, so set flag to true
    00033                 m_instance = new ExManagerVertexArrays; // Create the error log
    00034         }else
    00035         {
    00036                 std::cout<<"Error singleton already created"<<std::endl;
    00037         }
    00038         return m_instance;
    00039 UnGuard
    00040 }
    00041
    00042 ExManagerVertexArrays::ExManagerVertexArrays(void)
    00043 {
    00044 }
    00045
    00046 ExManagerVertexArrays::~ExManagerVertexArrays(void)
    00047 {
    00048         m_flag =false;
    00049 }
    00050
    00051 void ExManagerVertexArrays::Reset(void)
    00052 {
    00053 Guard(void ExManagerVertexArrays::Reset(void))
    00054 UnGuard
    00055 }
    00056
    00057 void ExManagerVertexArrays::Init(void)
    00058 {
    00059 Guard(void ExManagerVertexArrays::Init(void))
    00060         glLockArraysEXT = NULL;
    00061         glUnlockArraysEXT = NULL;
    00062         char *extList = (char *) glGetString(GL_EXTENSIONS);
    00063         //checking for compiled vertex array
    00064         if(extList && strstr(extList,"GL_EXT_compiled_vertex_array"))
    00065         {
    00066                 #ifdef UNIX_SRC
    00067                 #else
    00068                         glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC) wglGetProcAddress("glLockArraysEXT");
    00069                         glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC) wglGetProcAddress("glUnLockArraysEXT");
    00070                 #endif
    00071                 //glEnableClientState ( GL_VERTEX_ARRAY );
    00072                 //glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
    00073         }
    00074         if(glLockArraysEXT = NULL){ *Consol<<"OpenGl glLockArraysEXT extension missing"<<std::endl; return;}
    00075         if(glUnlockArraysEXT = NULL){ *Consol<<"OpenGl glUnlockArraysEXT extension missing"<<std::endl; return;}
    00076         *Consol<<"ExManagerVertexArrays::GL_EXT_compiled_vertex_array found and enable"<<std::endl;
    00077 UnGuard
    00078 }
    00079
    00080 int ExManagerVertexArrays::RegisterArray(GLfloat *vertex,GLfloat *texture)
    00081 {
    00082 Guard(void ExManagerVertexArrays::RegisterArray(GLfloat *vertex,GLfloat *texture))
    00083         GLint x=0;
    00084         m_Texture=texture;
    00085         m_Vertex=vertex;
    00086         glVertexPointer(3, GL_FLOAT, 0, m_Vertex);
    00087         //glTexCoordPointer(2, GL_FLOAT, 0, m_Texture);
    00088         std::cout<<x<<std::endl;
    00089         return x;
    00090 UnGuard
    00091 }
    00092
    00093 void ExManagerVertexArrays::DrawElements(GLint Start,GLsizei count)
    00094 {
    00095 Guard(void ExManagerVertexArrays::ExManagerVertexArrays::DrawElements(GLint Start,GLsizei count))
    00096         glDrawArrays(GL_LINE_STRIP,Start,count);
    00097         //std::cout<<"ploouf"<<std::endl;
    00098 UnGuard
    00099 }