Jump to content
  • Advertisement
Sign in to follow this  
vpk

OpenGL objects on terrain

This topic is 3737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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??

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!