Drawing primitives ?

Return to C++ coding using Panda3D

Drawing primitives ?

Postby Juggernaut » Sun Apr 29, 2012 6:07 pm

Hello,

I am unable to find in the manual - methods / functions to draw primitives - like sphere / cube / cylinder etc.
at run time using code.

Can anybody please advice on how to achieve these ?

Thnaks,
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Panda3D does not render primitives at all.

Postby EdmundosTown » Sun Apr 29, 2012 10:48 pm

Somewhere someday I read that Panda3D does not render primitives, if you want to render a cube, sphere, etc. you need to have the egg file with the model ... But as I know there are "primitives" on default Panda3D dist like cube.egg, sphere.egg, etc. but see yourself. :D
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico

Postby Juggernaut » Mon Apr 30, 2012 6:49 am

@EdmundosTown: Thank you. So the bottom line is I will have to always load 3D models from hard disk - even when I am trying draw simple primitives like - sphere, cone, cube, cylinder etc. I guess it is a lacking feature in Panda3D which is commonly available in other engines.
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

I think all engines do this.

Postby EdmundosTown » Mon Apr 30, 2012 11:17 am

If you look at other engines that can draw primitives, actually they do this task in other terms, I mean, you need to load a library wich contain vertex per vertex of a primitive, library that lives in the hard disk, or you have to call a function with sometimes goes to the hard disk an load a binary file to the memory. Something like that happens with bam files:

Bam files (with the extension .bam), on the other hand, are binary files that are closely tied to a particular version of Panda3D. The bam format is designed to be as similar as possible to the actual Panda data structures, so that a bam file is relatively small and can be loaded very quickly.

By the way, you can add this particular feature creating by yourself a library that contain "loaded-bam-files" so you can include and setup more quickly

:) Hope I help. Good coding.
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico

Postby Juggernaut » Mon Apr 30, 2012 11:49 am

@EdmundosTown: Thank you for your reply. Actually I think I have used the wrong term - "other engines".

The fact is, I am coming from a Dark Basic pro background which has inbuilt functions create primitives at runtime with the option to specify the number of polygons that should be used to draw the sphere. And I am sure that no model gets loaded by the fact that Dark Basic Pro does not come with a default set models within its installation package like Panda. I am not comparing Dark Basic Pro with Panda here. I am just querying if such facilities are available in Panda too. So please do not start throwing flames at me ...... :)
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Postby wezu » Mon Apr 30, 2012 1:02 pm

I think Panda only understands very basic primitives
-Triangles
-Tristrips
-Trifans
-Lines
-Linestrips
-Points

Check this out:
http://www.panda3d.org/manual/index.php/GeomPrimitive

Also, you can procedurally generate cubes spheres or a even a torus knot with one function... but you will need to write that function yourself, panda can help with that:
http://www.panda3d.org/manual/index.php ... rtexFormat
http://www.panda3d.org/manual/index.php ... ex_formats
http://www.panda3d.org/manual/index.php ... VertexData
http://www.panda3d.org/manual/index.php ... ve_objects
http://www.panda3d.org/manual/index.php ... cene_graph
I may be totally wrong, cause I'm a dancin' fool.
User avatar
wezu
 
Posts: 514
Joined: Tue May 19, 2009 1:03 pm

Postby Juggernaut » Mon Apr 30, 2012 2:32 pm

@wezu: Thank you for your help.
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am


Return to C++ coding using Panda3D

Who is online

Users browsing this forum: No registered users and 0 guests