1.) the client and the opengl screencoordinates are inverted in the y direction.
i fixed it like this: Code:
int cOverviewmap::clientopenglcalc(int number) // y axis correction
{
return (ScreenInfo.iHeight - number);
}
2.)we have to restore the viewport....
so basicly all you have to do is: Code:
glViewport(cvar.radar_x,clientopenglcalc(cvar.radar_y)-cvar.radar_size,cvar.radar_size,cvar.radar_size); // viewport is made here
// Render your ovmap
overview_redraw();
// we was using another viewport, this sets it back.
glViewport(0,0,ScreenInfo.iWidth,ScreenInfo.iHeight);
and here is the fixed radar draw function: Code:
void cOverviewmap::CalculateRadarPoint(float* origin, int * screenx, int * screeny)
{
float aim [3],newaim [3];
aim[0] = origin[0] - me.ent->origin[0];
aim[1] = origin[1] - me.ent->origin[1];
aim[2] = origin[2] - me.ent->origin[2];
VecRotateZ(aim, -mainViewAngles[1], newaim);
switch((int)cvar.radar)
{
case 2:
{
*screenx = (ScreenInfo.iWidth /2) - int( newaim[1]/cvar.zoom * m_OverviewData.zoom);
*screeny = (ScreenInfo.iHeight/2) - int( newaim[0]/cvar.zoom * m_OverviewData.zoom);
break;
}
case 3:
{
*screenx = (cvar.radar_x + (cvar.radar_size /2)) - int( newaim[1]/cvar.zoom * m_OverviewData.zoom);
*screeny = (cvar.radar_y + (cvar.radar_size /2)) - int( newaim[0]/cvar.zoom * m_OverviewData.zoom);
break;
}
default:
{
*screenx = (cvar.radar_x) - int( newaim[1]/cvar.zoom * m_OverviewData.zoom);
*screeny = (cvar.radar_y) - int( newaim[0]/cvar.zoom * m_OverviewData.zoom);
break;
}
}
}