Jump to content
  • Advertisement
Sign in to follow this  
geo2004

delay when picking and moving an object

This topic is 4141 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

I am attmpting a small game. I am having issues when I select an object and then tell it to move to a given spot. I can pick it, and move it, but there is a 1-7ish second gap between the two, depending on how many objects I am drawing (usually about a 1/2 second delay per object). Also, if one is moving, and I select another one, the moving one stops, then continues after a few seconds. Anyone know what is causing EVERYthing to stop when ever I select an object? The objects are .jpg images of a robot that i masked. Background is a large jpg texture. I am using Nehe's lesson 32 of picking as a guide. The way I am selecting is the same, using the selection buffer. Using VS2005 Express, GLUT, and DevIL. Jeff

Share this post


Link to post
Share on other sites
Advertisement
I don't think anyone can guess what's wrong without more info. The problem could be in your code, but the problem could be the driver and/or hardware too. If your driver's picking implementation sucks, it could be slow.

Show us some code (though not your whole application).

Share this post


Link to post
Share on other sites
Thanks for the quick reply.
I didn't know if anyone could say what was wrong, I just asked cuz I didn't know if it was a common problem, and i was overlooking something.

It could be the pc i'm on. I'm using my laptop from work cuz i don't have my desktop hooked up (just moved into a new place).

Anyways, heres the important parts of the code...

Selection function, happens on left mouse click...
GLuint buffer[512];
GLint sel;
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glSelectBuffer(512, buffer);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(xm,viewport[3]-ym, 1.0f, 1.0f, viewport);
gluPerspective(45.0f, (GLfloat) (viewport[2]-viewport[0])/(GLfloat)(viewport[3]-viewport[1]), 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);
drawBots();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopName();
sel=glRenderMode(GL_RENDER);
.....
choose=buffer[3];
bot[choose].selected=true;
....

then to move them, I do a check for the right mouse Click.
I cycle through all the bots, and if it is selected, its destination is set to the click spot.

thats the basics. let me know if you see a problem, or if you want more code.

Jeff

Share this post


Link to post
Share on other sites
I'm no expert at opengl picking, but nothing jumps out at me as wrong (anyone else?).

It being a laptop rings alarm bells for me. Video card driver support for them is notoriously poor. So that's a strong possibility. Another possibility is that you haven't installed the proper drivers at all, and hence opengl is running in software mode. Check the website for the laptop's vendor and is what drivers they offer.

Share this post


Link to post
Share on other sites
You are right about it probably being the computer. I put it on my desktop pc last night and ran it, and it was very smooth, no delay at all. I need to see what drivers i need for this lap top, although i don't usually use it to program on, its just my work comp(with vista, boo).

Thanks for the help gharen!

Jeff

Share this post


Link to post
Share on other sites
Quote:
Original post by geo2004
with vista


Hah, well that's doubly bad. Right now video card drivers for vista are barely up to snuff on desktops, never mind laptops.

Share this post


Link to post
Share on other sites
Yes you are very correct, the drivers for almost anything is horrible. Vista is a very different OS, some things are good, some are very bad, IMO. Overall i don't really like it, its a memory hog, and there are compatibility issues with a lot of things.

Give it a year, and it will be a good OS.

Jeff

Share this post


Link to post
Share on other sites
Yes, I totally upgraded my pc a few months ago, but stuck with xp. I'll switch to vista when I upgrade again in a couple years :) .

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!