Hello LeetSniperSephirothNinjaDemon, Could you, please, use your normal name? Typing the above gets old fast and I hate mistyping people's names. We are mature people here. Keep such handles for World of Warcraft or some other online game, please.
On Wed, Dec 25, 2013 at 9:16 PM, [email protected] < [email protected]> wrote: > Dear List members! > ... > The code works perfectly. And I could modify it to make sphere out of > that. But I fear the result would be really taxing, even on modern > hardware. How did you figure out that it would be taxing? That code generates mesh for a sphere. That calculation would be done normally just once. The rendering then follows using e.g. a display list, vertex buffer object or vertex arrays with the already prepared data - probably the fastest way it can be done. OSG takes care of that. > I read Stackoverflow questions and various articles I found, and some of > those said that I could just use a „mathematical shape” to do this. I am not sure what a "mathematical shape" is. A 3D object can be defined in many ways - e.g. as a polyhedron (like the sphere in your example) using vertices and faces, or you can use some mathematical representation using e.g. parametric equations (e.g. from here for an ellipsoid: http://mathworld.wolfram.com/Ellipsoid.html ) or using implicit equations, as a composition of several objects (look up metaballs or CSG modelling), etc. However, for 3D rendering using OpenGL/OSG the polyhedral mesh is the most common representation. Anything else you could use you would have to finally convert into a mesh, because that is the only thing the hardware and the APIs deal with. There are some special cases/techniques, like point-based rendering, that don't use meshes, but lets not go there - that is a really niche scenario. > I have lost my browsing history since then, so I cannot link the exact > page right now. It was a geometrical shape that would "become" a sphere > with the right "resolution". (You get the point, catch my drift. Like how > you make a cylinder.) > Well, I am not sure that I am "catching your drift". Care to be more specific? Do you want to generate the spherical mesh with different amount of slices? There is an "approx" parameter that controls how fine the subdivision should be. Otherwise you could use e.g. this type of code (adapted to OSG from that Windows-specific mess): http://stackoverflow.com/questions/4405787/generating-vertices-for-a-sphere > > But. Which one should I go with? > It would help if you could explain what exactly are you trying to achieve, though - it is difficult to help you like this. The answer pretty much depends on what do you need that sphere/shapes for. > More importantly: Is there a pre-existing code that I could use my base > and that I could build upon? > Or any foundation would be much appreciated. The more shapes I could learn > the better. > (So far I got basic things like cubes, rectangles, circle [from the > message], pyramid, cylinder.) The code you posted works - everything else is done in the same way - e.g. for a cube you must create 8 vertices and 6 faces, fill the arrays and let OSG render it. However, if your goal is just to get the shapes, it is much easier to create these primitives using a modelling software (e.g. Blender, 3DS Max, Maya, Wings3D, Milkshape, ...) and then load them into your OSG application. Regards, Jan
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

