Giancarlo

05-30-2010, 03:25 PM

Hello OpenGLrs,

this is my problem: I have a window and I render a texture over a plane. The texture coordinates I created is a regular grid spaced by 10 pixel. So that each texutre coordinate differs from one another by 1/10.

As soon as I click on the window I grab the correspondent text coordinate and I update it by moving the mouse, generating another glutPostRedisplay(); But nothing happens, I was expecting a stretch of the texture :(

My Display is this:

glBegin(GL_QUADS);

for(int j = 0; j < 10; j++) {

for(int i = 0; i < 10; i++){

glTexCoord2f(txtGrid[i][j].x,txtGrid[i][j].y); glVertex2d(grid[i][j].x,grid[i][j].y);

glTexCoord2f(txtGrid[i+1][j].x,txtGrid[i+1][j].y);glVertex2d(grid[i+1][j].x,grid[i+1][j].y);

glTexCoord2f(txtGrid[i+1][j+1].x,txtGrid[i+1][j+1].y);glVertex2d(grid[i+1][j+1].x,grid[i+1][j+1].y);

glTexCoord2f(txtGrid[i][j+1].x,txtGrid[i][j+1].y);glVertex2d(grid[i][j+1].x,grid[i][j+1].y);

}

}

glEnd();

glFlush();

and in the MouseMove I have this:

cursor.center.x = x;

cursor.center.y = windw.y-y;

//printf("found: %d\n",Found);

// printf("%d, %d \n",fx, fy);

if (Found == 1) {

grid[fx][fy].x = cursor.center.x;

grid[fx][fy].y = cursor.center.y;

txtGrid[fx][fy].x = cursor.center.x/windw.x;

txtGrid[fx][fy].y = cursor.center.y/windw.y;

}

Any Help?

Thanks.

Giancarlo

this is my problem: I have a window and I render a texture over a plane. The texture coordinates I created is a regular grid spaced by 10 pixel. So that each texutre coordinate differs from one another by 1/10.

As soon as I click on the window I grab the correspondent text coordinate and I update it by moving the mouse, generating another glutPostRedisplay(); But nothing happens, I was expecting a stretch of the texture :(

My Display is this:

glBegin(GL_QUADS);

for(int j = 0; j < 10; j++) {

for(int i = 0; i < 10; i++){

glTexCoord2f(txtGrid[i][j].x,txtGrid[i][j].y); glVertex2d(grid[i][j].x,grid[i][j].y);

glTexCoord2f(txtGrid[i+1][j].x,txtGrid[i+1][j].y);glVertex2d(grid[i+1][j].x,grid[i+1][j].y);

glTexCoord2f(txtGrid[i+1][j+1].x,txtGrid[i+1][j+1].y);glVertex2d(grid[i+1][j+1].x,grid[i+1][j+1].y);

glTexCoord2f(txtGrid[i][j+1].x,txtGrid[i][j+1].y);glVertex2d(grid[i][j+1].x,grid[i][j+1].y);

}

}

glEnd();

glFlush();

and in the MouseMove I have this:

cursor.center.x = x;

cursor.center.y = windw.y-y;

//printf("found: %d\n",Found);

// printf("%d, %d \n",fx, fy);

if (Found == 1) {

grid[fx][fy].x = cursor.center.x;

grid[fx][fy].y = cursor.center.y;

txtGrid[fx][fy].x = cursor.center.x/windw.x;

txtGrid[fx][fy].y = cursor.center.y/windw.y;

}

Any Help?

Thanks.

Giancarlo