Jump to content

Gdp?


Recommended Posts

I've start to reading HDK docs and totally confused...there's everywhere mentioned some 'gdp', but nowhere described _what is it_. Can anybody shed some light on it? What is gdp, where i can read about it?

Moreover: i'm trying to make a sop which will build some polygonal geometry. How to add points, make links between them, what geometry description Houdini requires? Where i can get all this info?

Thank you.

Link to comment
Share on other sites

The gdp is basically a pointer to the data that is passed in and out of the sop, you generally alter it in the cookMySop function that you have to write for every custom sop to work. I'm sure Edward or George can give you a proper technical explanation. You use the gdp pointer to call functions from GU_Detail (generally) so for example gdp->clearAndDestroy() clears the data prior to you creating your own geometry in place of what was passed in. You also use it to access point/prim positions to either read them or write to them. Basically anything that involves data from your geometry will involve the gdp somehow.

If you check out the hdk html help and look for this path (you'll need to modify it to your Houdini install path)

file:///C:/Program%20Files/Side%20Effects%20Software/Houdini%208.0.524/toolkit/html/geometry/primitive.html

about half way down is this useful piece of code for creating polys,

GU_Detail gdp;
GU_PrimPoly *poly;
if (poly = GU_PrimPoly::build(&gdp, 4, GU_POLY_CLOSED)) { // Assign some value to each vertex:
for (int i = 0; i < poly->getVertexCount(); i++)
(*poly)(i).getPos().assign(i,0,0,1); }

also look at the SOP_Star.C example in the SOP samples directory.

Link to comment
Share on other sites

It sounds good to me, Simon. I love it when the self-proclaimed "artist" is coaching the HDK. :P My advice is to tear apart and make sure you understand the HDK examples. Unfortunately, they also require a good knowledge of C++.

Link to comment
Share on other sites

It sounds good to me, Simon. I love it when the self-proclaimed "artist" is coaching the HDK. :P My advice is to tear apart and make sure you understand the HDK examples. Unfortunately, they also require a good knowledge of C++.

26803[/snapback]

Ha ha, no problem, as long as you jump in when i start steering people up a blind alley.....

Link to comment
Share on other sites

It's a bit of a catch 22, do the developers take time off to write detailed docs in the hope that more developers get involved writing extensions or do they just get on with it themselves..... for a small team like Sesi have I think it still makes sense for them to get on with the developement themselves. That said I've always found them very helpful in giving pointers in how to do things you just need to get past the basics.

Link to comment
Share on other sites

Yup, the HDK is *community* supported.

I'm just ecstatic that they decided to bundle it with the main product -- that took a lot of people requesting it for a long time, believe me.

But armed with the few examples and a set of "Doxygenated" pages, it's actually not that bad at all. Any lingering confusion after that can be usually cleared up with a post here, thanks to the kind support from the SESI visitors to this forum: edward, george, crunch, mtucker, malexander (and I'm probably missing a few).

I just can't imagine not having the HDK around now -- limited support and all, I don't want to ever have to go back to the "bad old days" :cry2:

The only real pre-requisite is that you have to be somewhat comfy with C++.

Link to comment
Share on other sites

Btw, concerning my problem: i still don't understand mesh structure, Houdini uses. For example, in Maya i have pointList, pointsPerFaceList for every face, and pointToFaceLinksList.

Suppose i have a 4-point face.

pointList will contain {p1, p2, p3, p4}

pointsPerFace will be {4} - 4 point per face number 0.

And pointToFaceLinksList will contain {0, 1, 2, 3} - numbers of points in pointList.

Does Houdini using similar or different scheme? Where i can read more about this?

Thank you.

Link to comment
Share on other sites

I think it's just terminology.

point -> point: means the same thing in the HDK

face -> primitive: a face is a special type of primitive. A primitive in H can be a polygon, a NURBS curve/surface, sphere, tube, etc.

pointToFaceLinks -> vertex (or vertices for plural): these are the point numbers belonging to a primitive.

In the GEO_Detail class, we find:

     const GEO_PointList  &points() const
     {
         return (const GEO_PointList&)ptList;
     }
     const GEO_PrimList  &primitives() const
     {
         return (const GEO_PrimList&)primList;
     }

This gives you essentially the points list and faces list. This is all assuming that you only have polygon geometry of course.

In the GEO_Primitive/GB_Primitive classes, we find:

    virtual unsigned  getVertexCount() const;
    virtual const GEO_Vertex	&getVertex(unsigned index) const;
    virtual GEO_Vertex  &getVertex(unsigned index);

So for each "face", we can get at the number of points belonging to it as well as the specific point information.

In the GEO_Vertex class, we find:

    GEO_Point  *getPt(void) const { return (GEO_Point*)getBasePt(); }

Given a vertex in a primitive, this gives us a pointer to its point. To get the point index, we find in the GB_Element class (from which GEO_Point is derived from):

    int    getNum() const { return myNum; }

You really need to go through and read the DOxygen docs. :)

Link to comment
Share on other sites

What Edward said. :)

But in case you haven't found some of the bits and pieces yet...

First, the html pages that come with the HDK ($HFS/toolkit/html/index.html) are a great starting point. I think they do a pretty good job of providing a bird's eye view of the general architecture. I would start there.

Then I'd recommend looking at a couple of the SOP samples (in $HFS/toolkit/samples). The easiest to begin with are SOP_Star and SOP_Flatten. (there are quite a lot of sample OPs in there, not just SOPs).

After that, if you don't want to go to the trouble of generating the Doxygen pages yourself (or don't know what the heck everybody's talking about), then you can find them pre-generated for you at the od[wiki].

But I don't recommend diving into these until you've had a chance to absorb the HDK's own html docs and tried to dissect some of the examples.

Last but not least, ask at this forum... which you've obviously already found :)

Happy coding, Joss!

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...