Hi,
I want to draw a border (color is not important, want to see the border) around a texture using border parameter of glTexImage. When border parameter is 1, border will be drawn, and border parameter is 0, border will not be drawn.
Around the investigation and manuals, it seems the below might work, but it didnt.
GLuint tex[1];
glGenTextures(1,tex);
glLoadIdentity();
glOrtho(0.0, TU_RC_WIDTH, 0.0, TU_RC_HEIGHT, -1.0, 1.0);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
GLubyte imageWithBorder[130][130][4];
for (i=0;i<130;i++)
for (j=0;j<130;j++)
{
imageWithBorder[i][j][0]=255;
imageWithBorder[i][j][1]=255;
imageWithBorder[i][j][2]=0;
imageWithBorder[i][j][3]=0;
}
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,tex[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, 4, 130, 130, 1, GL_RGBA, GL_UNSIGNED_BYTE,
imageWithBorder);
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 1.0); glVertex2f(100.0, 100.0);
glTexCoord2f(1.0, 1.0); glVertex2f(300.0, 100.0);
glTexCoord2f(1.0, 0.0); glVertex2f(300.0, 300.0);
glTexCoord2f(0.0, 0.0); glVertex2f(100.0, 300.0);
glEnd();
This code does not draw a border (at Windows platform. )
what is wrong here ? Is there a way to draw (enable / disable) the border using border parameter ?
(Note: without giving GL_CLAMP_TO_BORDER as parameter to glTexParameter)
TIA