shape files

Hi everyone
I am working on displaying .shp(shape) files in OpenGL so if you all can just help me out in knowing how to display thm

Do you mean this file format ?
At a first glance it seems to be fairly simple. A .shp file may contain points, lines or polygons.
Points and lines can be directly fed to opengl. Polygons need to be tessellated into triangles first.

thanks a lot for your reply
if you have some sample code related to this then just give me a link to it.

Nope, I haven’t used this format myself yet.

I don’t know what your experience level with opengl or programming in general is, but if you got stuck on any specific problem, feel free to ask !

i have not gone in depth into OpenGL.
i m just working on how to display .shp files in OpenGL on linu platform
i have got many libraries to use in windows but nothing useful in linux so far.

Are you kidding ?
First result for “shapefile lib”

i have gone through the details of shape files.
Just wanna know a method to use them in my OpenGL application.
If you have a sample code or any useful link on how to use thm thn kindly send it to me

(1) Read the primitives (points/lines/polygons) from the shapefile,

(2) tessellate polygons into triangles (you might want to take a look at GLU), and

(3) send them to opengl for rasterization.

You might want to use the bounding box provided in the shapefile header to set up your projection matrix, so the geometry will actually fit in your window.

If this doesn’t (fully) answer your question, maybe you should ask more detailed :wink:

thanks a lot for your reply.
i am not able to open .shp file for rading the primitives.
so can u kindly suggest me how to do it

I have explained this in this article …