Mesh* MeshBuilder::GenerateOBJ(const std::string &meshName, const std::string &file_path) { //Read vertices, texcoords & normals from OBJ std::vector<Position> vertices; std::vector<TexCoord> uvs; std::vector<Vector3> normals; bool success = LoadOBJ(file_path.c_str(), vertices, uvs, normals); if (!success) return NULL; //Index the vertices, texcoords & normals properly std::vector<Vertex> vertex_buffer_data; std::vector<GLuint> index_buffer_data; IndexVBO(vertices, uvs, normals, index_buffer_data, vertex_buffer_data); //Create the mesh and call glBindBuffer, glBufferData //Use triangle list and remember to set index size Mesh *mesh = new Mesh(meshName); glBindBuffer(GL_ARRAY_BUFFER, mesh->vertexBuffer); glBufferData(GL_ARRAY_BUFFER, vertex_buffer_data.size()*sizeof(Vertex), &vertex_buffer_data[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, mesh->indexBuffer); glBufferData(GL_ARRAY_BUFFER, index_buffer_data.size()*sizeof(GLuint), &index_buffer_data[0], GL_STATIC_DRAW); mesh->indexSize = index_buffer_data.size(); mesh->mode = Mesh::DRAW_TRIANGLES; return mesh; }
Mesh* MeshBuilder::GenerateOBJ(const std::string &meshName, const std::string &file_path) { std::vector<Position> vertices; std::vector<TexCoord> uvs; std::vector<Vector3> normals; bool success = LoadOBJ(file_path.c_str(), vertices, uvs, normals); if (!success) return NULL; std::vector<Vertex> vertex_buffer_data; std::vector<GLuint> index_buffer_data; IndexVBO(vertices, uvs, normals, index_buffer_data, vertex_buffer_data); Mesh *mesh = new Mesh(meshName); mesh->mode = Mesh::DRAW_TRIANGLES; glBindBuffer(GL_ARRAY_BUFFER, mesh->vertexBuffer); glBufferData(GL_ARRAY_BUFFER, vertex_buffer_data.size() * sizeof(Vertex), &vertex_buffer_data[0], GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->indexBuffer); glBufferData(GL_ELEMENT_ARRAY_BUFFER, index_buffer_data.size() * sizeof(GLuint), &index_buffer_data[0], GL_STATIC_DRAW); mesh->indexSize = index_buffer_data.size(); return mesh; }
/* * Start up GLUT and tell it what to do */ int main(int argc,char* argv[]) { // Initialize GLUT glutInit(&argc,argv); // Request double buffered, true color window with Z buffering at 600x600 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize(600,600); glutCreateWindow("NDC RGB Shader"); #ifdef USEGLEW // Initialize GLEW if (glewInit()!=GLEW_OK) Fatal("Error initializing GLEW\n"); if (!GLEW_VERSION_2_0) Fatal("OpenGL 2.0 not supported\n"); #endif // Set callbacks glutDisplayFunc(display); glutReshapeFunc(reshape); glutSpecialFunc(special); glutKeyboardFunc(key); // Load object model = LoadOBJ("tyra.obj"); // Create Shader Programs shader[1] = CreateShaderProg("ndcrgb.vert","ndcrgb.frag"); shader[2] = CreateShaderProg("ndcrgb.vert",NULL); shader[3] = CreateShaderProg(NULL,"ndcrgb2.frag"); // Initialize location x = y = z = 0; // Pass control to GLUT so it can interact with the user ErrCheck("init"); glutMainLoop(); return 0; }
int main(int argc,char* argv[]) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(1000,1000); glutCreateWindow("Textures Assignment (Seth Perry)"); //sets the function that handles window reshaping to reshape. glutReshapeFunc(reshape); //sets the display function to display glutDisplayFunc(display); //set the idle function to idle glutIdleFunc(idle); //sets the special key function to special glutSpecialFunc(special); //sets the keyboard function to key glutKeyboardFunc(key); getHourOfDay(); loadTextures(); determineTreeLocations(); generateDisplayLists(); pew=LoadOBJ("pew.obj"); //check for errors ErrCheck("init"); //gives control to GLUT so user input can be managed. glutMainLoop(); return 0; }
/* * Start up GLUT and tell it what to do */ int main(int argc,char* argv[]) { // Initialize GLUT glutInit(&argc,argv); if (argc!=2 && argc!=3 && argc!=6) Fatal("Usage: %s <obj> [scale [R G B]]\n",argv[0]); // Request double buffered, true color window with Z buffering at 600x600 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize(600,600); glutCreateWindow("Model Loader"); // Set callbacks glutDisplayFunc(display); glutReshapeFunc(reshape); glutSpecialFunc(special); glutKeyboardFunc(key); glutIdleFunc(idle); // Set scale if (argc>=3) scale = strtod(argv[2],NULL); if (scale<=0) scale = 1; // Set color if (argc>=6) RGBA[0] = strtod(argv[3],NULL); if (argc>=6) RGBA[1] = strtod(argv[4],NULL); if (argc>=6) RGBA[2] = strtod(argv[5],NULL); // Load object obj = LoadOBJ(argv[1]); // Pass control to GLUT so it can interact with the user ErrCheck("init"); glutMainLoop(); return 0; }
//----------------------------------------------------------------------------------------------- renderer::IStaticMesh* CStaticMeshLoader_OBJ::loadStaticMesh(io::IFile* file,const char* hint) { u32 FileStart = file->getPos(); renderer::IStaticMesh* mesh = LoadOBJ(file); file->seek(FileStart); return mesh; }
/* Start up GLUT and tell it what to do */ int main(int argc,char* argv[]) { // Initialize GLUT and process user parameters glutInit(&argc,argv); // Request double buffered, true color window with Z buffering at 600x600 glutInitWindowSize(600,600); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); // Create the window glutCreateWindow("Car Game Simulation"); // Tell GLUT to call "display" when the scene should be drawn glutDisplayFunc(display); // Tell GLUT to call "reshape" when the window is resized glutReshapeFunc(reshape); // Tell GLUT to call "special" when an arrow key is pressed glutSpecialFunc(special); // Tell GLUT to call "key" when a key is pressed glutKeyboardFunc(key); // Tell GLUT to call idle function glutIdleFunc(idle); glutTimerFunc(3000,timerFunction,0); // Load textures texture[0] = LoadTexBMP("checks.bmp"); texture[1] = LoadTexBMP("redmetal.bmp"); texture[2]=LoadTexBMP("lamp.bmp"); texture[3]=LoadTexBMP("flower.bmp"); texture[4]=LoadTexBMP("bark.bmp"); texture[6]=LoadTexBMP("bestcar.bmp"); texture[7]=LoadTexBMP("cars.bmp"); sky[0]=LoadTexBMP("crosswalk.bmp"); sky[1]=LoadTexBMP("building.bmp"); sky[2]=LoadTexBMP("panorama_360.bmp"); sky[3]=LoadTexBMP("roadpylon.bmp"); sky[4]=LoadTexBMP("clouds2.bmp"); sky[5]=LoadTexBMP("sign.bmp"); sky[6]=LoadTexBMP("land0.bmp"); car1=LoadOBJ("sls_amg.obj"); car2=LoadOBJ("california.obj"); dragon=LoadOBJ("dragon.obj"); // Pass control to GLUT so it can interact with the user ErrCheck("init"); glEnable(GL_DEPTH_TEST); glutMainLoop(); return 0; }
Model* LoadModel(char* name) { Model* model = 0; Mesh* mesh = LoadOBJ(name); if (!mesh) return 0; DecomposeToTriangles(mesh); generateNormals(mesh); model = generateModel(mesh); return model; }
//----------------------------------------------------------------------------------------------- renderer::IStaticMesh* CStaticMeshLoader_OBJ::loadStaticMesh(const char* path) { io::IFile* mesh_file = m_FileSystem->open_file(path); if(!mesh_file) return nullptr; renderer::IStaticMesh* mesh = LoadOBJ(mesh_file); mesh_file->release(); if(!mesh) return nullptr; return mesh; }
VertexBuffer* ModelLoader::Load(ContentMetadata& what) { string model_name = what.name; VertexBuffer* vbo = new VertexBuffer(Triangles); vbo->AddAttribute("gl_Vertex", Float, 3); vbo->AddAttribute("gl_Normal", Float, 3); vbo->AddAttribute("gl_MultiTexCoord0", Float, 3); vbo->AddAttribute("gl_MultiTexCoord1", Float, 3); vbo->AddAttribute("gl_MultiTexCoord2", Float, 3); int aam_result = LoadAAM("Files/Models/" + model_name + ".aam", vbo); if(aam_result != 0) { stringstream aam_msg; aam_msg << "LoadAAM (" << model_name << ") returned with status " << aam_result << "; falling back to OBJ" << endl; Debug(aam_msg.str()); int obj_result = LoadOBJ("Files/Models/" + model_name + ".obj", vbo); if(obj_result != 0) { stringstream obj_msg; obj_msg << "...And then LoadOBJ returned with status " << obj_result << "!" << endl; Debug(obj_msg.str()); vbo->Dispose(); delete vbo; return NULL; } else { SaveAAM("Files/Models/" + model_name + ".aam", vbo, true); Debug("Successfully created AAM from OBJ\n"); } } // if we got here it means we didn't fail too many times... return vbo; }
/* * Main */ int main(int argc, char *argv[]) { // Initialize GLUT and process user parameters glutInit(&argc, argv); // Request double buffered, true color window glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); // Request 500 x 500 pixel window glutInitWindowSize(800, 800); // Create the window glutCreateWindow("Sahle Alturaigi: \"Say HELLO, Clank!\""); // Tell GLUT to call "display" when the scene should be drawn glutDisplayFunc(display); // Tell GLUT to call "reshape" when the window is resized glutReshapeFunc(reshape); // Tell GLUT to call "special_key" when an arrow key is pressed glutSpecialFunc(special_key); // Tell GLUT to call "key" when a key is pressed glutKeyboardFunc(key); // Tell GLUT to call idle when the program is not being interacted. glutIdleFunc(idle); // *** Loading objects here *** // OBJ_Head = LoadOBJ("blender_obj//Head.obj"); OBJ_Hand = LoadOBJ("blender_obj//Hand.obj"); OBJ_Body = LoadOBJ("blender_obj//Body.obj"); OBJ_RightShoulder = LoadOBJ("blender_obj//Right_Shoulder_hinge.obj"); OBJ_LeftShoulder = LoadOBJ("blender_obj//Left_Shoulder_hinge.obj"); OBJ_Right_hand2 = LoadOBJ("blender_obj//Right_hand2.obj"); OBJ_Left_hand2 = LoadOBJ("blender_obj//Left_hand2.obj"); // *** End loading objects *** // // Checks for any thrown errors ErrCheck("init"); // Pass control to GLUT so it can interact with the user glutMainLoop(); return 0; }
Mesh* MeshBuilder::GenerateOBJ(const std::string &meshName, const std::string &file_path) { //Read vertices, texcoords & normals from OBJ std::vector<Position> vertices; std::vector<TexCoord> uvs; std::vector<Vector3> normals; bool success = LoadOBJ(file_path.c_str(), vertices, uvs, normals); if (!success) return NULL; //Index the vertices, texcoords & normals properly std::vector<Vertex> vertex_buffer_data; std::vector<GLuint> index_buffer_data; for (size_t i = 0; i < vertex_buffer_data.size(); ++i) { index_buffer_data.push_back(i); } ////verticeNum = &vertices; Position maxPos = Position(0, 0, 0); // Vector for max pos Position minPos = Position(0, 0, 0); // Vector for min pos Position * posPtr1 = 0; for (size_t i = 0; i < vertices.size(); ++i) { posPtr1 = &vertices[i]; if (posPtr1->x > maxPos.x) { maxPos.x = posPtr1->x; } if (posPtr1->x < minPos.x) { minPos.x = posPtr1->x; } if (posPtr1->y > maxPos.y) { maxPos.y = posPtr1->y; } if (posPtr1->y < minPos.y) { minPos.y = posPtr1->y; } if (posPtr1->z > maxPos.z) { maxPos.z = posPtr1->z; } if (posPtr1->z < minPos.z) { minPos.z = posPtr1->z; } } maxPos.x += 0.1f; maxPos.y += 0.1f; maxPos.z += 0.1f; minPos.x -= 0.1f; minPos.y -= 0.1f; minPos.z -= 0.1f; IndexVBO(vertices, uvs, normals, index_buffer_data, vertex_buffer_data); //Create the mesh and call glBindBuffer, glBufferData //Use triangle list and remember to set index size Mesh *mesh = new Mesh(meshName); glBindBuffer(GL_ARRAY_BUFFER, mesh->vertexBuffer); glBufferData(GL_ARRAY_BUFFER, vertex_buffer_data.size() * sizeof(Vertex), &vertex_buffer_data[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, mesh->indexBuffer); glBufferData(GL_ARRAY_BUFFER, index_buffer_data.size() * sizeof(GLuint), &index_buffer_data[0], GL_STATIC_DRAW); mesh->indexSize = index_buffer_data.size(); mesh->mode = Mesh::DRAW_TRIANGLES; mesh->maxPos = maxPos; mesh->minPos = minPos; return mesh; }
void Initialize() { printf("Version Pilote OpenGL : %s\n", glGetString(GL_VERSION)); printf("Type de GPU : %s\n", glGetString(GL_RENDERER)); printf("Fabricant : %s\n", glGetString(GL_VENDOR)); printf("Version GLSL : %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION)); int numExtensions; glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); GLenum error = glewInit(); if (error != GL_NO_ERROR) { // TODO } #if LIST_EXTENSIONS for (int index = 0; index < numExtensions; ++index) { printf("Extension[%d] : %s\n", index, glGetStringi(GL_EXTENSIONS, index)); } #endif #ifdef _WIN32 // on coupe la synchro vertical pour voir l'effet du delta time wglSwapIntervalEXT(0); #endif // render states par defaut glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glEnable(GL_CULL_FACE); // AntTweakBar TwInit(TW_OPENGL, NULL); // ou TW_OPENGL_CORE selon le cas de figure objTweakBar = TwNewBar("Multiple Point Lights"); TwAddVarRW(objTweakBar, "Num Point Lights", TW_TYPE_UINT32, &g_NumPointLights, ""); TwAddButton(objTweakBar, "Quitter", &ExitCallbackTw, nullptr, ""); // Objets OpenGL glGenBuffers(1, &g_Camera.UBO); glBindBuffer(GL_UNIFORM_BUFFER, g_Camera.UBO); glBufferData(GL_UNIFORM_BUFFER, sizeof(glm::mat4) * 2, nullptr, GL_STREAM_DRAW); glGenBuffers(1, &PointLight::UBO); glBindBuffer(GL_UNIFORM_BUFFER, PointLight::UBO); glBufferData(GL_UNIFORM_BUFFER, sizeof(PointLight) * MAX_POINT_LIGHTS, nullptr, GL_STREAM_DRAW); glGenBuffers(1, &Material::UBO); glBindBuffer(GL_UNIFORM_BUFFER, Material::UBO); glBufferData(GL_UNIFORM_BUFFER, sizeof(Material), &g_ShinyMaterial, GL_STATIC_DRAW); error = glGetError(); assert(error == GL_NO_ERROR); g_AmbientShader.LoadVertexShader("ambient.vs"); g_AmbientShader.LoadFragmentShader("ambient.fs"); g_AmbientShader.Create(); auto program = g_AmbientShader.GetProgram(); glBindBufferBase(GL_UNIFORM_BUFFER, 0, g_Camera.UBO); auto blockIndex = glGetUniformBlockIndex(program, "ViewProj"); glUniformBlockBinding(program, blockIndex, 0); error = glGetError(); assert(error == GL_NO_ERROR); g_BlinnPhongShader.LoadVertexShader("blinnPhong.vs"); g_BlinnPhongShader.LoadFragmentShader("blinnPhong.fs"); g_BlinnPhongShader.Create(); program = g_BlinnPhongShader.GetProgram(); //glBindBufferBase(GL_UNIFORM_BUFFER, 0, g_Camera.UBO); // deja bound blockIndex = glGetUniformBlockIndex(program, "ViewProj"); glUniformBlockBinding(program, blockIndex, 0); glBindBufferBase(GL_UNIFORM_BUFFER, 1, PointLight::UBO); blockIndex = glGetUniformBlockIndex(program, "Lights"); glUniformBlockBinding(program, blockIndex, 1); glBindBufferBase(GL_UNIFORM_BUFFER, 2, Material::UBO); blockIndex = glGetUniformBlockIndex(program, "Material"); glUniformBlockBinding(program, blockIndex, 2); // Setup error = glGetError(); assert(error == GL_NO_ERROR); previousTime = glutGet(GLUT_ELAPSED_TIME); LoadMesh(g_WallMesh, g_Room); LoadAndCreateTextureRGBA("wall_color_map.jpg", g_Walls.textures[Walls::gWallTexture]); glBindTexture(GL_TEXTURE_2D, g_Walls.textures[Walls::gWallTexture]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); LoadAndCreateTextureRGBA("floor_color_map.jpg", g_Walls.textures[Walls::gFloorTexture]); glBindTexture(GL_TEXTURE_2D, g_Walls.textures[Walls::gFloorTexture]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); LoadAndCreateTextureRGBA("ceiling_color_map.jpg", g_Walls.textures[Walls::gCeilingTexture]); glBindTexture(GL_TEXTURE_2D, g_Walls.textures[Walls::gCeilingTexture]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); const std::string inputFile = "sphere.obj"; LoadOBJ(g_SphereMesh, inputFile); g_Spheres.resize(g_NumPointLights); for (uint32_t index = 0; index < g_NumPointLights; ++index) { g_Spheres[index].initialize(index); } error = glGetError(); assert(error == GL_NO_ERROR); }
const bool CCPrimitiveObj::load(const char* file) { CCText fullFilePath; CCFileManager::getFilePath( fullFilePath, file, Resource_Packaged ); /* attempt to load the file */ ObjMesh *objMesh = LoadOBJ( fullFilePath.buffer ); { for( uint i=0; i<objMesh->m_iNumberOfFaces; ++i ) { ObjFace *pf = &objMesh->m_aFaces[i]; if( pf->m_iVertexCount >= 3 ) { uint faceVertexCount = pf->m_iVertexCount; do { vertexCount += 3; faceVertexCount--; } while( faceVertexCount >= 3 ); } } modelUVs = (float*)malloc( sizeof( float ) * vertexCount * 2 ); vertices = (float*)malloc( sizeof( float ) * vertexCount * 3 ); normals = (float*)malloc( sizeof( float ) * vertexCount * 3 ); int uvIndex = 0; int vertexIndex = 0; for( uint i=0; i<objMesh->m_iNumberOfFaces; ++i ) { ObjFace *pf = &objMesh->m_aFaces[i]; if( pf->m_iVertexCount < 3 ) { continue; } uint vertexStartIterator = 1; uint vertexEndIterator = 3; do { // Convert GL_POLYGON to GL_TRIANGLES by reusing the first vert, with the others { uint j=0; // UVs { ObjTexCoord &texCoord = objMesh->m_aTexCoordArray[ pf->m_aTexCoordIndicies[j] ]; modelUVs[uvIndex+0] = texCoord.u; modelUVs[uvIndex+1] = 1.0f - texCoord.v; } // Vertices { ObjVertex &vertex = objMesh->m_aVertexArray[ pf->m_aVertexIndices[j] ]; vertices[vertexIndex+0] = vertex.x; vertices[vertexIndex+1] = vertex.y; vertices[vertexIndex+2] = vertex.z; mmX.consider( vertex.x ); mmY.consider( vertex.y ); mmZ.consider( vertex.z ); } // Normals { ObjNormal &normal = objMesh->m_aNormalArray[ pf->m_aNormalIndices[j] ]; normals[vertexIndex+0] = normal.x; normals[vertexIndex+1] = normal.y; normals[vertexIndex+2] = normal.z; } uvIndex += 2; vertexIndex += 3; } for( uint j=vertexStartIterator; j<vertexEndIterator; ++j ) { // UVs { ObjTexCoord &texCoord = objMesh->m_aTexCoordArray[ pf->m_aTexCoordIndicies[j] ]; modelUVs[uvIndex+0] = texCoord.u; modelUVs[uvIndex+1] = 1.0f - texCoord.v; } // Vertices { ObjVertex &vertex = objMesh->m_aVertexArray[ pf->m_aVertexIndices[j] ]; vertices[vertexIndex+0] = vertex.x; vertices[vertexIndex+1] = vertex.y; vertices[vertexIndex+2] = vertex.z; mmX.consider( vertex.x ); mmY.consider( vertex.y ); mmZ.consider( vertex.z ); } // Normals { ObjNormal &normal = objMesh->m_aNormalArray[ pf->m_aNormalIndices[j] ]; normals[vertexIndex+0] = normal.x; normals[vertexIndex+1] = normal.y; normals[vertexIndex+2] = normal.z; } uvIndex += 2; vertexIndex += 3; } vertexStartIterator++; vertexEndIterator++; } while( vertexEndIterator <= pf->m_iVertexCount ); } width = mmX.size(); height = mmY.size(); depth = mmZ.size(); } DeleteOBJ( objMesh->m_iMeshID ); return vertexCount > 0; }
// Create an STShape from a geometric model file. // Currently only supports the OBJ file format. STShape::STShape(const std::string& filename) { if (LoadOBJ(filename) != ST_OK) { throw new std::runtime_error("Error creating STShape"); } }
//used to generate display lists void generateDisplayLists() { treeList = glGenLists(1); glNewList(treeList, GL_COMPILE); int t; for(t=0; t< numTrees; t++) { int depth = rand() % 3 + 4; int angle = rand() % 30 + 30; glPushMatrix(); glTranslated(treeLocations[t][0],-10,treeLocations[t][1]); tree(depth, 5,100, 0,angle); glPopMatrix(); } glEndList(); cathedralList = glGenLists(1); glNewList(cathedralList, GL_COMPILE); //main cathedral archCustom(370,-9.9,450, 6,6,1, 270, 440,75, 150, insideArchTextures); archCustom(-370,-9.9,450, 6,6,1, 90, 440,75, 150, insideArchTextures); archCustom(0,440,-300, 6,6,1, 0, 1200,0, 150, insideArchTextures); archCustom(0,440,825, 6,6,1, 180, 450,0, 150, insideArchTextures); //roof of cathedral archCustom(370,440,450, 6.01,6.5,1, 270, 440,0, 150, outsideArchTextures); archCustom(-370,440,450, 6.01,6.5,1, 90, 440,0, 150, outsideArchTextures); archCustom(0,440,-300, 6.01,6.5,1, 0, 1200,0, 150, outsideArchTextures); archCustom(0,440,825, 6.01,6.5,1, 180, 450,0, 150, outsideArchTextures); //TO DO: FIX OVERLAP UNDERNEATH //front aisles cube(260,204.47,-250, 1099.5,1,227.75, 15,90, outsideArchTextures[1]); cube(-260,204.47,-250, 1099.5,1,227.75, 15,-90, outsideArchTextures[1]); cube(260,204.47,820, 439.5,1,227.75, 15,90, outsideArchTextures[1]); cube(-260,204.47,820, 439.5,1,227.75, 15,-90, outsideArchTextures[1]); drawAisleCompartment(-795,150, insideArchTextures, woodTexture); drawAisleCompartment(-575,150, insideArchTextures, woodTexture); drawAisleCompartment(-355,150, insideArchTextures, woodTexture); drawAisleCompartment(-135,150, insideArchTextures, woodTexture); drawAisleCompartment(85,150, insideArchTextures, woodTexture); //back aisles drawAisleCompartment(605,150, insideArchTextures, woodTexture); drawAisleCompartment(825,150, insideArchTextures, woodTexture); //doors on crossing aboveArch(-260, -10, 300, 4,2,1, 180, 55,35, 2.5, insideArchTextures); aboveArch(-480, -10, 300, 4,2,1, 180, 55,35, 2.5, insideArchTextures); door(-480, -10, 300, 4,2,1, 180, 55, woodTexture); aboveArch(260, -10, 300, 4,2,1, 180, 55,35, 2.5, insideArchTextures); aboveArch(480, -10, 300, 4,2,1, 180, 55,35, 2.5, insideArchTextures); door(480, -10, 300, 4,2,1, 180, 55, woodTexture); aboveArch(-260, -10, 600, 4,2,1, 0, 55,35, 2.5, insideArchTextures); aboveArch(-480, -10, 600, 4,2,1, 0, 55,35, 2.5, insideArchTextures); door(-480, -10, 600, 4,2,1, 0, 55, woodTexture); aboveArch(260, -10, 600, 4,2,1, 0, 55,35, 2.5, insideArchTextures); aboveArch(480, -10, 600, 4,2,1, 0, 55,35, 2.5, insideArchTextures); door(480, -10, 600, 4,2,1, 0, 55, woodTexture); //altar cube(0,-10.1,830, 300,2.5,450, 0,0, woodTexture); cube(0,-7.5,700, 50,10,20, 0,0, altarTexture); cube(0,2.5,700, 60,2.5,30, 0,0, altarTexture); glEndList(); naveAisleList= glGenLists(1); glNewList(naveAisleList, GL_COMPILE); glEndList(); towerList = glGenLists(1); glNewList(towerList, GL_COMPILE); //front towers tower(0,515,-900, 300,150,400,100, 0, insideArchTextures[0],outsideArchTextures[1]); tower(260.1,-10.1,-875, 220,500,475,150, 0, insideArchTextures[0],outsideArchTextures[1]); tower(-260.1,-10.1,-875, 220,500,475,150, 0, insideArchTextures[0],outsideArchTextures[1]); archCustom(0,-250,-900, 5,2,1, 0, 100,200, 0, insideArchTextures); aboveArch(0, -10, -850, 5,2,1, 0, 80,27.5, 5, insideArchTextures); aboveArch(0, -10, -950, 5,2,1, 180, 80,27.5, 5, insideArchTextures); aboveArch(0, 275, -850, 5,2,1, 0, 80,27.5, 5, insideArchTextures); aboveArch(0, 275, -950, 5,2,1, 180, 80,27.5, 5, insideArchTextures); door(0, -10, -850, 5,2,1, 0, 80, woodTexture); door(0, -10, -950, 5,2,1, 180, 80, woodTexture); //back towers tower(0,-10,1180, 300,675,400,250, 0, insideArchTextures[0],outsideArchTextures[1]); tower(260.1,-10.1,1185, 220,675,300,300, 0, insideArchTextures[0],outsideArchTextures[1]); tower(-260.1,-10.1,1185, 220,675,300,300, 0, insideArchTextures[0],outsideArchTextures[1]); //left tower tower(640,-10.1,450, 350,675,300,100, 90, insideArchTextures[0],outsideArchTextures[1]); //right tower tower(-640,-10.1,450, 350,675,300,100, 90, insideArchTextures[0],outsideArchTextures[1]); glEndList(); pew = LoadOBJ("pew.obj"); pewList = glGenLists(1); glNewList(pewList, GL_COMPILE); glColor4f(0.289,0.160,0.082,1); int pewX; int pewZ; for(pewX=35; pewX <=110; pewX += 25) { for(pewZ=-300; pewZ <= 240; pewZ +=15) { adjustList(pewX,-10,pewZ, 2,2,2, 180,pew); adjustList(-1*pewX,-10,pewZ, 2,2,2, 180,pew); } } glEndList(); floorList = glGenLists(1); glNewList(floorList, GL_COMPILE); glColor4f(0.868,0.805,0.699,1); glBindTexture(GL_TEXTURE_2D, tileTexture); glBegin(GL_QUADS); glNormal3d(0,1,0); glTexCoord2f(0.0,0.0); glVertex3d(-370.0,-9.9,-950.0); glTexCoord2f(0.0,193.5); glVertex3d(-370.0,-9.9,1035.0); glTexCoord2f(74.0,193.5); glVertex3d(370.0,-9.9,1035.0); glTexCoord2f(74.0,0.0); glVertex3d(370.0,-9.9,-950.0); glNormal3d(0,1,0); glTexCoord2f(0.0,0.0); glVertex3d(-600.0,-9.9,300.0); glTexCoord2f(0.0,30.0); glVertex3d(-600.0,-9.9,600.0); glTexCoord2f(120.0, 30.0); glVertex3d(600.0,-9.9,600.0); glTexCoord2f(120.0, 0.0); glVertex3d(600.0,-9.9,300.0); glEnd(); glEndList(); crossList = glGenLists(1); glNewList(crossList, GL_COMPILE); cube(0,100,1000, 5,100,5, 0,0, woodTexture); cube(0,175,1000, 75,5,5, 0,0, woodTexture); glEndList(); }