PDA

View Full Version : How to Draw tree using OpenGL



Alghafri
03-12-2014, 02:31 AM
Hello

I am using visual stdio ... c++

how i can draw tree

??

I need help >>>

Agent D
03-12-2014, 06:51 AM
What is that thing that you call a tree anyway? Are you trying to visualize a data structure? Do you want to draw an image of a plant that people commonly refere to as a tree?

OpenGL(R) is lowlevel rasterization (https://en.wikipedia.org/wiki/Rasterisation) API, not a fancy 3D engine. There is no glDrawTrees( ) function. Using modern OpenGL(R), you have allocate a vertex buffer and probably index buffer and load a triangle approximation of whatever you call a tree into that. You have to write a shader program that runs on the GPU to transform the triangles of your "tree" and to determine the color of the pixels once the triangles get rasterized, etc....

If you want to quickly move forward with your one time tree drawing demands, my advice would be to use a highlevel 3D engine like this (http://irrlicht.sourceforge.net/) one or that (http://ogre3d.org/) one.

If you want to learn how to use OpenGL(R), it is adviseable to first understand what OpenGL(R) is and what it is not (http://www.opengl.org/wiki/FAQ#What_is_OpenGL.3F). If you understand what OpenGL(R) is, know what triangle rasterization means and have basic understandings of linear algebra, you will easily figure out (after some practice) how to draw a tree by building on top of the OpenGL(R) API.

As a starting point for OpenGL(R) tutorials, I would suggest this website (http://www.opengl-tutorial.org/).

Alghafri
03-16-2014, 06:03 AM
thank u a lot my dear :o