Ok so im new to this forum so i hope im not doing anything wrong in regards to forum rules. ive searched all over for similar problems to mine but to no avail. i am trying to bind a sf::image and then use glbegin(GL_QUADS) to draw the image to screen, this is working with other images but not this specific image, i have run through the debugger and am sure that the image has not lost scope as it still knows all data regarding the image, yet whilst every other image i draw to screen works, this does not draw anything, similarly i have tried drawing a simple GL quad without binding an image and only using glcolor, it draws the quad in the correct position and all but it is mostly transparent and is dark green regardless of what glcolor i input. i really hope this is some kind of newbish mistake, its driving me crazy.
void TileSet_Manager::Render()
{
///////////////////////////////////////////////////
///this is working and draws all images correctly
////////////////////////////////////////////////
for (int i = 0 ; i < TotalTiles;++i)
{
Tiles[i].Render();
}
//////////////////////////////////////////////////////
/////this however draws nothing
/////////////////////////////////////////////////////
float X = m_Min.GetX();
float Y = m_Min.GetY();
float X2 = m_Max.GetX();
float Y2 = m_Min.GetY();
Menu->Bind();
glBegin(GL_QUADS);
glColor4f(1.0f,0.0f,0.0f,1.0f);
glTexCoord2f(0,0);
glVertex2f(X,Y);
glTexCoord2f(1,0);
glVertex2f(X2,Y);
glTexCoord2f(1,1);
glVertex2f(X2,Y2);
glTexCoord2f(0,1);
glVertex2f(X,Y2);
glColor4f(1.0f,1.0f,1.0f,1.0f);
glEnd();
float x = currSelected->GetPos().GetX();
float y = currSelected->GetPos().GetY();
currSlcBox->Bind();
/////////////////////////////////////////////////////////
//this just draws a semi transparent green box regardless whether or not i use gl color
/////////////////////////////////////////////////////////
glBegin(GL_QUADS);
glVertex2f(x - TileSize/2 - 1,y - TileSize/2 - 1);
glVertex2f(x + TileSize/2 + 1,y - TileSize/2 - 1);
glVertex2f(x + TileSize/2 + 1,y + TileSize/2 + 1);
glVertex2f(x - TileSize/2 - 1,y + TileSize/2 + 1);
glEnd();
}
and here is the code for Tile.render()
void Tile::Render()
{
m_TileTexture->Bind();
float U1 = m_MinUV.GetX();
float V1 = m_MinUV.GetY();
float U2 = m_MaxUV.GetX();
float V2 = m_MaxUV.GetY();
glBegin(GL_QUADS);
glTexCoord2f(U1,V1);
glVertex2f(m_Pos.GetX() - TileSize/2,m_Pos.GetY() - TileSize/2);
glTexCoord2f(U2,V1);
glVertex2f(m_Pos.GetX() + TileSize/2, m_Pos.GetY() - TileSize/2);
glTexCoord2f(U2,V2);
glVertex2f(m_Pos.GetX() + TileSize/2, m_Pos.GetY() + TileSize/2);
glTexCoord2f(U1,V2);
glVertex2f(m_Pos.GetX() - TileSize/2, m_Pos.GetY() + TileSize/2);
glEnd();
}
furthermore ive gone through the VS Debugger step by step and made sure that all variables such as m_Pos and U1,V1,U2 etc are all correct. why do the tiles draw but the menu image doesnt, ive changed what image it loads and it still doesnt work.