/** * \brief remove all OSD textures and display-lists, thus clearing it. */ static void clearOSD(void) { int i; if (!osdtexCnt) return; DeleteTextures(osdtexCnt, osdtex); #ifndef FAST_OSD DeleteTextures(osdtexCnt, osdatex); for (i = 0; i < osdtexCnt; i++) DeleteLists(osdaDispList[i], 1); #endif for (i = 0; i < osdtexCnt; i++) DeleteLists(osdDispList[i], 1); osdtexCnt = 0; }
void printttglist() { char msg[101]; LNKLST_NODE *node; printf("\nDATA GAP INFO\n"); node = listFirstNode(messageList); if(node==NULL) { printf("\nNo gaps found\n"); } else { memset(msg,' ', 101);msg[99]='\n';msg[100]=0; memcpy(msg,"Stream",6); memcpy(&msg[40],"Gap",3); memcpy(&msg[80],"Length",6); printf(msg); } while (node != NULL) { printf((char *)node->payload); node = listNextNode(node); } DeleteLists(); }
void GL2ChunkRenderer::destroyChunkData(vec3i64 chunkCoords) { auto it = renderInfos.find(chunkCoords); if (it != renderInfos.end()) { if (it->second.dl != 0) { GL(DeleteLists(it->second.dl, 1)) } renderInfos.erase(it); } }
/** * \brief remove textures, display list and free memory used by EOSD */ static void clearEOSD(void) { if (eosdDispList) DeleteLists(eosdDispList, 1); eosdDispList = 0; if (eosdtexCnt) DeleteTextures(eosdtexCnt, eosdtex); eosdtexCnt = 0; free(eosdtex); eosdtex = NULL; }
//========================================================================= int Epetra_MapColoring::GenerateLists() const { int NumMyElements = Map().NumMyElements(); if (NumMyElements==0) return(0); // Nothing to do if (ListsAreValid_) return(0); // Already been here if (ListsAreGenerated_) DeleteLists(); // Delete any existing lists // Scan the ElementColors to determine how many colors we have NumColors_ = 1; FirstColor_ = new ListItem(ElementColors_[0]); // Initialize First color in list for (int i=1; i<NumMyElements; i++) if (!InItemList(ElementColors_[i])) NumColors_++; // Create hash table that maps color IDs to the integers 0,...NumColors_ ColorIDs_ = new Epetra_HashTable<int>(NumColors_); ListOfColors_ = new int[NumColors_]; ListItem * CurItem = FirstColor_; {for (int i=0; i<NumColors_; i++) { ColorIDs_->Add(CurItem->ItemValue, i); // Create hash table entry ListOfColors_[i] = CurItem->ItemValue; // Put color value in a list of colors CurItem = CurItem->NextItem; }} Epetra_Util util; util.Sort(true, NumColors_, ListOfColors_, 0, 0, 0, 0, 0, 0); // Sort List of colors in ascending order // Count the number of IDs of each color ColorCount_ = new int[NumColors_]; {for (int i=0; i<NumColors_; i++) ColorCount_[i] = 0;} {for (int i=0; i<NumMyElements; i++) ColorCount_[ColorIDs_->Get(ElementColors_[i])]++;} // Finally build list of IDs grouped by color ColorLists_ = new int *[NumColors_]; {for (int i=0; i<NumColors_; i++) ColorLists_[i] = new int[ColorCount_[i]];} {for (int i=0; i<NumColors_; i++) ColorCount_[i] = 0;} // Reset so we can use for counting {for (int i=0; i<NumMyElements; i++) { int j = ColorIDs_->Get(ElementColors_[i]); ColorLists_[j][ColorCount_[j]++] = i; }} ListsAreValid_ = true; ListsAreGenerated_ = true; return(0); }
void GL2ChunkRenderer::applyChunkVisuals(ChunkVisuals chunkVisuals) { numQuads = 0; for (Quad quad : chunkVisuals.quads) { vec2f texs[4]; GL2TextureManager::Entry tex_entry = ((GL2Renderer *) renderer)->getTextureManager()->get(quad.faceType, quad.bc, quad.faceDir); GL2TextureManager::getTextureCoords(tex_entry.index, tex_entry.type, texs); faceIndexBuffer[numQuads] = FaceIndexData{tex_entry.tex, numQuads}; vb[numQuads].normal[0] = DIRS[quad.faceDir][0]; vb[numQuads].normal[1] = DIRS[quad.faceDir][1]; vb[numQuads].normal[2] = DIRS[quad.faceDir][2]; for (int j = 0; j < 4; j++) { vb[numQuads].tex[j][0] = texs[j][0]; vb[numQuads].tex[j][1] = texs[j][1]; float light = 1.0f - quad.shadowLevels[j] * 0.2f; vb[numQuads].color[j][0] = light; vb[numQuads].color[j][1] = light; vb[numQuads].color[j][2] = light; vec3f vertex = (quad.icc.cast<int>() + DIR_QUAD_CORNER_CYCLES_3D[quad.faceDir][j]).cast<float>(); vb[numQuads].vertex[j][0] = vertex[0]; vb[numQuads].vertex[j][1] = vertex[1]; vb[numQuads].vertex[j][2] = vertex[2]; } ++numQuads; } auto it = renderInfos.find(chunkVisuals.cc); if (numQuads > 0) { if (it == renderInfos.end()) { auto pair = renderInfos.insert({chunkVisuals.cc, RenderInfo()}); it = pair.first; } if (it->second.dl == 0) { it->second.dl = glGenLists(1); } std::sort(&faceIndexBuffer[0], &faceIndexBuffer[numQuads], [](const FaceIndexData &l, const FaceIndexData &r) { return l.tex < r.tex; }); glNewList(it->second.dl, GL_COMPILE); GLuint lastTex = 0; for (int facei = 0; facei < numQuads; ++facei) { const FaceIndexData *fid = &faceIndexBuffer[facei]; const FaceVertexData *fvd = &vb[fid->index]; if (fid->tex != lastTex) { glBindTexture(GL_TEXTURE_2D, fid->tex); lastTex = fid->tex; } glBegin(GL_QUADS); glNormal3f(fvd->normal[0], fvd->normal[1], fvd->normal[2]); for (int j = 0; j < 4; j++) { glTexCoord2f(fvd->tex[j][0], fvd->tex[j][1]); glColor3f(fvd->color[j][0], fvd->color[j][1], fvd->color[j][2]); glVertex3f(fvd->vertex[j][0], fvd->vertex[j][1], fvd->vertex[j][2]); } glEnd(); } glEndList(); LOG_OPENGL_ERROR; } else if (it != renderInfos.end()) { if (it->second.dl != 0) { GL(DeleteLists(it->second.dl, 1)) } renderInfos.erase(it); } }
//========================================================================= Epetra_MapColoring::~Epetra_MapColoring(){ if (Allocated_ && Map().NumMyElements()>0) delete [] ElementColors_; if (ListsAreGenerated_) DeleteLists(); }