[PyOpenGL-Users] Pyopengl - slow performance using
Brought to you by:
mcfletch
From: <pm...@gm...> - 2011-01-13 11:29:36
|
Hi all, I am developing an application using pyopenGL to read data from a shape file and to draw it in 2D using openGl. However, the performance is really bad; it takes up to 20 seconds to draw the map. I am using Ubuntu and nVidia NVS 3100M. The shape file being read has the following characteristics: - 50 000 entries containing the description roads segments; each road segment has the associated geometry (set of (x,y) points ) - +/- 350 000 points in total A simplified version of the code is shown bellow: a) to get data from shapefile (using pyshapelib) and store it in a list of lists of tuples (python): ... self.shp = [] self.extents = [] self.array = [] ... self.shp = shapelib.ShapeFile(filename) for i in range(self.shp.info()[0]): lineVert = self.shp.read_object(i).vertices() tempArray = [] for j in lineVert[0]: tempArray.append([j[0],j[1]]) self.array.append(tempArray) b) to draw the data using pyopenGL: ... glEnableClientState(GL_VERTEX_ARRAY) # obtained from the shapefile(array element) arrayList = self.map.getArrayList() if len(arrayList) > 0: for objMap in arrayList: self.drawPolyline(objMap) def drawPolyline(self,inArray): #glColor(1.0, 0.0, 0.0) glVertexPointerf(inArray) glDrawArrays(GL_LINE_STRIP, 0, len(inArray)) - Do you have any hints how to improve the performance dramatically and make it usable? I tried several options but none worked out. For instance I tried to replace python list with numpy arrays but the performance was not significantly changed. - Do I need execute the OpenGL code in C? Altough I could do this, I still need to use python as scripting language due to other dependencies of the implementation. Thank you in advance for your help! Best Regards, Pedro -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de |