void CCursorIcons::Draw() { if (icons.empty() || !cmdColors.UseQueueIcons()) { return; } glDepthMask(GL_FALSE); glEnable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0.0f, 1.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glAlphaFunc(GL_GREATER, 0.01f); glColor4f(1.0f, 1.0f, 1.0f, cmdColors.QueueIconAlpha()); int currentCmd = (icons.begin()->command + 1); // force the first binding CMouseCursor* currentCursor = NULL; std::set<Icon>::iterator it; for (it = icons.begin(); it != icons.end(); ++it) { if (it->command != currentCmd) { currentCmd = it->command; currentCursor = GetCursor(currentCmd); if (currentCursor != NULL) { currentCursor->BindTexture(); } } if (currentCursor != NULL) { float3 winPos = camera->CalcWindowCoordinates(it->pos); if (winPos.z <= 1.0f) { currentCursor->DrawQuad((int)winPos.x, (int)winPos.y); } } } glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); glDepthMask(GL_TRUE); glViewport(gu->screenxPos,0,gu->screenx,gu->screeny); // clear the list icons.clear(); }
void CCursorIcons::DrawCursors() { if (icons.empty() || !cmdColors.UseQueueIcons()) { return; } glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0.0f, 1.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glColor4f(1.0f, 1.0f, 1.0f, cmdColors.QueueIconAlpha()); int currentCmd = (icons.begin()->cmd + 1); // force the first binding CMouseCursor* currentCursor = NULL; std::set<Icon>::iterator it; for (it = icons.begin(); it != icons.end(); ++it) { const int command = it->cmd; if (command != currentCmd) { currentCmd = command; currentCursor = GetCursor(currentCmd); if (currentCursor != NULL) { currentCursor->BindTexture(); } } if (currentCursor != NULL) { const float3 winPos = camera->CalcWindowCoordinates(it->pos); if (winPos.z <= 1.0f) { currentCursor->DrawQuad((int)winPos.x, (int)winPos.y); } } } DrawTexts(); // use the same transformation glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }