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 glLockArraysEXT = NULL; 00045 glUnlockArraysEXT = NULL; 00046 } 00047 00048 ExManagerVertexArrays::~ExManagerVertexArrays(void) 00049 { 00050 m_flag =false; 00051 } 00052 00053 void ExManagerVertexArrays::Reset(void) 00054 { 00055 Guard(void ExManagerVertexArrays::Reset(void)) 00056 UnGuard 00057 } 00058 00059 void ExManagerVertexArrays::Init(void) 00060 { 00061 Guard(void ExManagerVertexArrays::Init(void)) 00062 glLockArraysEXT = NULL; 00063 glUnlockArraysEXT = NULL; 00064 char *extList = (char *) glGetString(GL_EXTENSIONS); 00065 //checking for compiled vertex array 00066 if(extList && strstr(extList,"GL_EXT_compiled_vertex_array")) 00067 { 00068 #ifdef UNIX_SRC 00069 #else 00070 glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC) 00071 wglGetProcAddress("glLockArraysEXT"); 00072 00073 glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC) 00074 wglGetProcAddress("glUnlockArraysEXT"); 00075 #endif 00076 //glEnableClientState ( GL_VERTEX_ARRAY ); 00077 //glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); 00078 } 00079 if(glLockArraysEXT = NULL){ *Consol<<"OpenGl glLockArraysEXT extension missing"<<std::endl; return;} 00080 if(glUnlockArraysEXT = NULL){ *Consol<<"OpenGl glUnlockArraysEXT extension missing"<<std::endl; return;} 00081 *Consol<<"ExManagerVertexArrays::GL_EXT_compiled_vertex_array found and enable"<<std::endl; 00082 00083 UnGuard 00084 } 00085 00086 int ExManagerVertexArrays::RegisterArray(GLfloat *vertex,GLfloat *texture) 00087 { 00088 Guard(void ExManagerVertexArrays::RegisterArray(GLfloat *vertex,GLfloat *texture)) 00089 GLint x=0; 00090 m_Texture=texture; 00091 m_Vertex=vertex; 00092 glVertexPointer(3, GL_FLOAT, 0, m_Vertex); 00093 //glTexCoordPointer(2, GL_FLOAT, 0, m_Texture); 00094 std::cout<<x<<std::endl; 00095 return x; 00096 UnGuard 00097 } 00098 00099 void ExManagerVertexArrays::DrawElements(GLint Start,GLsizei count) 00100 { 00101 Guard(void ExManagerVertexArrays::ExManagerVertexArrays::DrawElements(GLint Start,GLsizei count)) 00102 00103 UnGuard 00104 }