objects on terrain

Started by
31 comments, last by Hodgman 15 years, 7 months ago
hi, i have created a terrain using c and opengl. now i wish to place some objects like a tree or cattle on the terrain. how do i do it? can it be done using opengl??
Advertisement
glBegin(GL_TRIANGLES);drawCastle();glEnd();


Okay, seriously. If you ask an open-ended question like this, you have to expect some pretty open-ended answers.

So. I'd suggest you make a castle or tree in a 3D modeller, like Blender or Milkshape 3D, both freeware and with either very simple file formats or very easy to make custom exporters for. In fact, Blender has a 3DS exporter, and I'm sure there's a half-dozen free 3DS readers out there which produce a model object with built-in OpenGL drawing routines.

Alternatively, you can just draw your castle using hard-coded GL primitives. You know, yourself, what a castle looks like. So make a drawWall() method that draws a wall from (0,0,0) to (1,0,0) and tile or rotate a few of those to make the walls. Make a drawTower() method that draws a tower from (0,0,0) to (0,0,1), and scale a few of those to the size you want. I suggest using a display list or vertex buffer, storing your entire castle into it, and then drawing it with a single batched call later on (after you get your slow prototype working, of course).
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
sorry for my query being insufficient..

i have a glb model of the object (cattle/man/woman)and a terrain.
what i wanted to know is how do i make model appear on the terrain.

any suggestions..
Which part are you having problems with - loading the glb model, rendering the loaded model, or positioning the model at the correct place in the world?
Quote:Original post by Hodgman
Which part are you having problems with - loading the glb model, rendering the loaded model, or positioning the model at the correct place in the world?


actually i havent yet started with any of these..so i need help regarding all the parts..
instead of the model i would like to place an image eg. tree.jpg/tree.bmp on the terrain.
can anyone tell me how this can be done.
or else suggest me some site/tutorial for the same.
Look up billboards and impostors.

I'm not familiar with GLB files, but you could always try wotsit, a huge repository of information about open and proprietary file formats: http://www.wotsit.org/

As far as getting around to the rendering, if you're drawing a terrain you've honestly already got 3/4s of what you need to know to draw the trees and other objects on it down pat.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
hi

thats exactly what i want to know. how do i render the tree which is an image jpg/bmp on to the terrain..

first i load the image from the file,
then how do i render it??
Quote:Original post by vpk
Quote:Original post by Wyrframe
Quote:Original post by vpk
i would like to place an image eg. tree.jpg/tree.bmp on the terrain.
Look up billboards and impostors.
how do i render the tree which is an image jpg/bmp on to the terrain..
Billboards @ Flipcode.
Billboards @ NeHe.
i have gone thru the sites..

i dont want to rotate the tree , i just want to place it on the terrain after loading it..

This topic is closed to new replies.

Advertisement