How would I select Individual objects??

Before all my critics yell at me and say to learn a pile of crap.
Let me tell you I have and have got gabys code working.
But one thing How would I make individual objects to select and deselect.
Heres the code he gave me

#include <vector>
struct Vert
{
float x, y, z;
};
struct Triangle
{
int ix[3];
};
struct Object
{
vector<Vert> verts;
vector<Triangle> tris;

void draw()
{
glEnableClientState( GL_VERTEX_ARRAY ); glVertexPointer( 3, GL_FLOAT, 0, &verts[0] );
glDrawElements( GL_TRIANGLES, tris.size()*3, GL_UNSIGNED_INT, &tris[0] );

glDisableClientState( GL_VERTEX_ARRAY );
}
void addVert( Vert const & v )
{
verts.push_back( v );
}
void addTriangle( Triangle const & t )
{
tris.push_back( t );
}
};
Please help

Originally posted by shanedudddy2:
Before all my critics yell at me and say to learn a pile of crap.
Let me tell you I have and have got gabys code working.
But one thing How would I make individual objects to select and deselect.
Heres the code he gave me

Holy crap!

You really dont get it.

You are the dumbass who called everyone here an: quote ‘arsehole’ in a different post, arent you?

What you called ‘crap’ are the very basics of the programming language you are trying to use but you are failing at even at the simplest tasks.

Your are trying to program in C/C++ but apprently you dont have a friggin clue how to allocate or even to fill a simple structure, this is something you would learn at your first day in a C course.

YOU HAVE TO KNOW A PROGRAMMING LANGUAGE BEFORE YOU CAN USE OPENGL.

I just wonder what your next retarted question would be… maybe “How do I save my crapy data into a file, please give me the source code or you are an arsehole…”

FU!

[This message has been edited by HS (edited 01-10-2003).]

I’m sorry but I have to agree with HS here. It looks to me that you are trying to build a house but don’t know how to use a hammer. And this “pile of crap” you mention is NOT a “pile of crap.” Everything about programming even if it seems useless has its place and purpose and should not be dismissed if you think it’s “crap.” Trust me on this, I one time in my early times of learning programming did such a thing and later on I realized I just screwed myself.

Ok so maybe ill try to make my post usefull by telling you one way you can select the object. You will obviously have to add stuff to your structures you have there. There is probably a better (ie faster) way to do this but at least this will work. The optimizing is up to you after it works. Ok I assume you know how to use OpenGL’s picking mechanism to select a triangle and know how to identify which triangle you selected. If not find a tutorial on OpenGL picking. Ok so say you click on a triangle and know which triangle you selected by its id it has assosiated with it. Now go through all of your object’s triangles untill you find a match. At this point you will know which object this triangle belongs to because in your loop, the loop control variable going through each object will be an index or id of the object you just selected. Again yes I know if you have a lot of objects this will be slow as hell. But like I said, optimizing is up to you. I don’t want to give away all the suprises.

-SirKnight

Me had kind of the same idea but for it I would need to know how to declare a vector with an identifier

for EXAMPLE:

char objectnumber[64];
objectnumber=1;

object_type cube(objectnumber)
that is not how you do it but is a good idea of what I`m trying to archieve
Please Help?

Here are some references for you that might help out with your problem:

http://www.amazon.com/exec/obidos/tg/det…=books&n=507846

http://www.amazon.com/exec/obidos/tg/det…=glance&s=books

http://www.stanford.edu/group/uga/

Originally posted by shanedudddy2:
[b]Me had kind of the same idea but for it I would need to know how to declare a vector with an identifier

for EXAMPLE:

char objectnumber[64];
objectnumber=1;

object_type cube(objectnumber)
that is not how you do it but is a good idea of what I`m trying to archieve
Please Help?[/b]

What you’re asking for is just general C++ knowledge. You need to read up on C++ classes and STL a bit more. I think you’re trying to bite off more than you can chew here.

-SirKnight