Hi
at the moment I can move individual objects but they move faster than the mouse pointer -what I would like now is to be able to move the objects under the mouse function - I have a selection buffer test-function which at the moment only output a message box stating the object that is selected or none if it is clicked elsewhere - how could I modify this function to select and drag objects
#define BUFSIZE 512
//pick objects
void CMyView: ickObjects( int x, int y)
{
GLuint selectBuf[BUFSIZE];
GLint hits, i,j, k;
GLint viewport[4];
int namez, z1,z2;
char linez[255], text[255], temp[255];
glGetIntegerv(GL_VIEWPORT,viewport);
glSelectBuffer(BUFSIZE,selectBuf);
glMatrixMode(GL_PROJECTION);
glPushMatrix ();
glLoadIdentity ();
(void) glRenderMode(GL_SELECT);
//create a selection/picking region
gluPickMatrix((GLdouble) x, (GLdouble)(viewport[3] - y), 1.0, 1.0, viewport);
gluPerspective(70.0, m_AspectRatio, 1.0, 300.0) ;
Render(GL_SELECT);
hits = glRenderMode(GL_RENDER);
glMatrixMode(GL_PROJECTION);
glPopMatrix ();
glMatrixMode(GL_MODELVIEW);
sprintf (text, "Total No. of hits (codas under mouse): %d
", hits);
j=0;
for(i=0; i<hits; i++)
{
namez = selectBuf [j]; j++;
z1 = selectBuf [j]; j++;
z2 = selectBuf [j]; j++;
sprintf (temp, "Number of CODAS: %d
Min z:%d
Max z: %d
", namez, z1, z2);
for(k=0; k<namez; k++)
{
sprintf(linez, "CODA No:%d
", selectBuf[j]);
j++;
}
strcat(text, temp);
strcat(text, linez);
}
strcat(text, "
Object Names:
BOX1 - 1
BOX2 - 2
BOX3 - 3");
MessageBox( text, “Hits!”, MB_OK);
hits = glRenderMode(GL_RENDER);
glMatrixMode(GL_MODELVIEW);
}
cheers