I am using OpenGL to draw a sphere however all of the effort are wasteless because am not used to code in c++, can anyone refer me on a tutorial to build it knowing that I can't use immediate mode in OpenGL I have to do everything by hand.
Asked
Active
Viewed 130 times
0
-
http://stackoverflow.com/questions/7946770/calculating-a-sphere-in-opengl – Grimmy May 22 '13 at 12:03
-
Alternatively, using billboards or point sprites, and a fragment shader: http://stackoverflow.com/a/10506172/572743 – Damon May 22 '13 at 12:06
-
am stuck with any open gl version above 3+ and i need to just understand a quick concept about them .. can you please be more specifique – The-Blood Chr May 22 '13 at 12:16
-
and if using shaders thats it ! i want something were shaders exist – The-Blood Chr May 22 '13 at 12:17
-
Diving into OpenGL without basic knowledge of the language you are using might be a bad idea, especially when you are using the programmable pipeline, instead of the fixed function pipeline functions. It's good that you don't want to use immediate mode though, because it's old and will be deprecated in a few years. If you have the time, I used [these tutorials](http://ogldev.atspace.co.uk/index.html) to get me going with modern OpenGL. – Kevin May 22 '13 at 12:17
-
[Hello Triangle](http://www.arcsynthesis.org/gltut/Basics/Tutorial%2001.html). This is, in principle, all you need. Add 30-40 more vertices to the array, and you have a sphere instead of a triangle. Or, alternatively, add 1 vertex for a rectangle (or use only 1 point and point size) and use a fragment shader that solves `sqrt(x*x + y*y + z*z)` for every fragment and calls `discard` if that is greater than the radius (sphere equation, basic geometry). Adding lighting left as exercise for the reader :-) – Damon May 22 '13 at 12:24
-
can u guide me with a code ? – The-Blood Chr May 22 '13 at 12:46
-
We both linked tutorials with code examples – Kevin May 22 '13 at 12:48
-
[This article](http://prideout.net/blog/?p=48) might help you out. – bwroga May 22 '13 at 13:08
-
The tutorials are not very clear when it comes to the orientation of the code its just fragments , my objective is to create a cube and put some texture on it or a sphere – The-Blood Chr May 22 '13 at 13:36
-
Or a video tutorial if available – The-Blood Chr May 22 '13 at 14:57
-
can nayone help please ? – The-Blood Chr May 22 '13 at 15:30
-
This website is not a resource for full working code. The tutorials provide you with everything you need to create your application, if it is not enough, you really should start with some easier things. Have you ever made a medium sized c++ program? I suggest learning c++ first, then OpenGL, and only after that shaders. – Kevin May 22 '13 at 17:22