Sign in to follow this  

counts in glDrawElements

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, im not really sure what the 'count' parameter contains in the glDrawElement function. Cause i've got this game and it allows you to retrieve the data that is stored in those parameters like 'count' in glDrawElements. But obviously count contains numbers to identify objects right? How can i find out what count value an object has? Im kinda in a hurry now so sorry if this is a little unclear ill try to explain it again if you're not sure of what i mean.

Share this post


Link to post
Share on other sites
Whaaaa? "count" specifies the number of elements to draw. What are you going on about with "identify object"? What object? What do you mean, "retrieve the data that is stored in those parameters"?

Share this post


Link to post
Share on other sites
Yeh its a project for school. Its sort of a game and we have to try to identify objects in that game.
We got the source code that hooked the opengl functions.
Now we can call any opengl function (just for that program/game)and see what the parameters contain for that function, like the 'count' parameter in glDrawElements.
So i thought if i did something like

if(count == 1100 || 1240 || 1460)
{
//a character
}
if(count == 570 || 780 || 860)
{
//something else
}


etc...
Not sure if its possible, thats why im just asking :)

Share this post


Link to post
Share on other sites
Ah, I see. No, the count parameter just happens to be different because different objects will have different numbers of elements. I suppose you could try to correlate the count parameter to a particular object, but there might be collisions.

Share this post


Link to post
Share on other sites
Thats the point, because every object has different number. Then thats a good way to identify them right?
I can imagine that the count value will change if the object is further away, although im not sure of that.
Are you sure that this isnt an option t accomplish my task??

Share this post


Link to post
Share on other sites
Probably a bad idea and almost certain to cause problems for you in the end.

In C++, the idiomatic way to check if objects are "the same" is to implement bool Object::operator== (const Object& rhs), which returns true iff they are "the same", and then call that (in exactly the natural way you would expect: "if (instance1 == instance2)". As for the actual implementation - it's up to you internally, but it's probably most common to compare "important" members (in turn relying on the operator== of those members).

Share this post


Link to post
Share on other sites

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this