drawing without rendering. is this possible?

i have some data that is being passed to my routine. this is contour lines data. the data contains of x,y values. i have to draw lines from these x,y values creating a polyline. these lines need to be drapped onto my terrain, but they dont come with the z values. there are 2 alternatives to choose :

  1. i create a bitmap from the x,y points. the bitmap will contain contour lines and the remaining pixels in the bitmap are transparent. but this would call for drawing lines by myself maybe using Bresenhams algorithm, which would be time consuming since there could be thousands of data points.

  2. another approach i am thinkin of is, i draw lines from the data points using glvertex, then get a snapshot of the frame buffer which has only the contour lines, make a texture out of it, and then drape it. but for this method, i will have to draw the lines (using glvertex) and not render them. if i render them, i dont know how its goin to look with my terrain already there. is there any way i can draw the contour lines in the back buffer, and get the data, convert it to a tex, and render the tex, and not the lines.

any suggestions on how to go about the second approach or any better suggestions are welcome.

The simplest way to do contour lines is to draw your geometry with a 1D texture mapped along the vertical axis. The 1D texture would be mostly white with black pixels at regular intervals.

Originally posted by mogumbo:
The simplest way to do contour lines is to draw your geometry with a 1D texture mapped along the vertical axis. The 1D texture would be mostly white with black pixels at regular intervals.

could u plz elaborate on that

You use a 1D texture that looks like this, where 0 = white and X = black.

0000000000X0000000000X0000000000X00000…

Then you use glTexGen() with GL_OBJECT_LINEAR to project that texture sideways across your terrain.

heres a snapshot of what im tryin to do
www.geocities.com/mithunp4u/

i will be passed a set of x,y points and i need to join them, make a tex and drape it.

[This message has been edited by mithun_daa (edited 01-13-2004).]

Ah, those lines don’t look like they follow the contours of the terrain, so my method wouldn’t work for you.

Originally posted by mithun_daa:
but for this method, i will have to draw the lines (using glvertex) and not render them. if i render them, i dont know how its goin to look with my terrain already there. is there any way i can draw the contour lines in the back buffer, and get the data, convert it to a tex, and render the tex, and not the lines.

glCopyTexImage2D(). Draw the lines first and copy them to a texture. Then clear the buffer and render your terrain with the texture draped over it.

Next time, please post in the beginner’s forum?

– Tom

And try RenderToTexture if you can, it is faster than copying from backbuffer.
See : http://www.chez.com/dedebuffer/