Advertisement

Object picking Kills framerate?

Started by July 12, 2003 11:29 PM
31 comments, last by skow 21 years, 7 months ago
davepermen - that''s pretty slick! Will try it out soon enough
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
oh, yeah.. to fully emulate GL_SELECT mode, just set glScissor to the actual pixel where you want to find out what object is..


to the AP.. how do you think opengl implements GL_SELECT? its a rastericer, it rasterices the whole things with the specified names into a buffer and voilà.

but you got me to the idea that they possibly only use 1 pixel where they draw on, so the Scissor should help.. thanks for the idea..

not that its slow anyways..



just be warned that sometimes colors don''t get returned the way you wanted.. thats something i don''t understand for now.. but it works for small values.. dunno really:D

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
I got a question...glColor3ubv wont take in a int * (&index). Is there somthing i''m not seeing?

Also for glReadPixels

glReadPixels(x,y,1,1,GL_COLOR_INDEX,GL_UNSIGNED_INT,&index)

Is that the settings you would want? I''m a bit unsure about the format and type vars.
I got it working using the individual red green and blue components of objects.

I''m still intreasted in sing how you can pass in the &int.

Thanks again dave, per click i lose 1 fps. so say i have 300 fps and i click 4 times a second i get a 296, heh this is alot better
Hmm I got a problem.

Some objects will change in number when the mouse is over them depending on the angle.

I took screenshots and compaired them in photoshop and they are the exact same color. Is there anything that would cause glReadPixels to read a slightly diffrent number depending on the angle im viewing the object? This happens to the higher number ojects further away.

[edited by - Skow on July 16, 2003 2:05:11 AM]
glColor4uvb() takes a pointer to an unsigned char array[4];

and as your index (should be an unsigned integer btw..) has the same size as an unsigned char[4], you can just feed it in instead, it gets interpreted by gl as unsigned char color[4] then..

and on the readback you tell gl to readback an unsigned char array[4] again, by telling GL_RGBA and GL_UNSIGNED_BYTE, and you give, again, instead just a pointer to an unsigned int in..


dunno about your color problems really..


but you''re sure you click at the right place? i remember i had to implement it like this: glReadPixels(x,height-y,....)

dunno..

what color do you readback, and what color should be there? compare the values.. (by reading it back into an unsigned char array[4] and then printing those four values out at best..:D

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
Hmm when i pass in a ∫ it says it can not convert from a int *, to a unasigned const char *.


Yeah im doing the "height-y" And its working well except for these few models at the end. This is very weird ill mess with it tonight when i get home from work.
you need to cast... glVertex4ubv((unsigned char*)&index)

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

*smack head*

I knew that, heh
My colors are stil changing when i have a diffrent angle of view on the objects.

This is happining to only 1/3 of the objects. I am really confused...

The angle is effecting how the readpixels gets the red component. At some angles it reads it correctly at others it doesnt read any red at all when there is red.

Any one know of any problems with the detection of GL_RED?

[edited by - skow on July 16, 2003 10:20:18 PM]

This topic is closed to new replies.

Advertisement