Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2010-04-30 00:09:07 +0400
committerStefan Hacker <dd0t@users.sourceforge.net>2010-04-30 00:45:25 +0400
commit11fda9bfcd0406c14791e113689fac71ebbca194 (patch)
tree0ad63d6911d29dcbd7663fced0c80422c7ca80c4 /overlay_gl
parent58bf724a3f0fea9f2e5c7e0125b44ac1f6a8891c (diff)
Fix *nix OpenGL overlay and add FPS counter code to OSX overlay.m
Diffstat (limited to 'overlay_gl')
-rw-r--r--overlay_gl/overlay.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c
index 67c6b03a2..711b7ecbe 100644
--- a/overlay_gl/overlay.c
+++ b/overlay_gl/overlay.c
@@ -422,6 +422,22 @@ static void drawOverlay(Context *ctx, unsigned int width, unsigned int height) {
}
static void drawContext(Context * ctx, int width, int height) {
+ clock_t t = clock();
+ float elapsed = (float)(t - ctx->timeT) / CLOCKS_PER_SEC;
+ ++(ctx->frameCount);
+ if (elapsed > OVERLAY_FPS_INTERVAL) {
+ struct OverlayMsg om;
+ om.omh.uiMagic = OVERLAY_MAGIC_NUMBER;
+ om.omh.uiType = OVERLAY_MSGTYPE_FPS;
+ om.omh.iLength = sizeof(struct OverlayMsgFps);
+ om.omf.fps = ctx->frameCount / elapsed;
+
+ sendMessage(ctx, &om);
+
+ ctx->frameCount = 0;
+ ctx->timeT = t;
+ }
+
GLint program;
GLint viewport[4];
int i;
@@ -572,22 +588,6 @@ void glXSwapBuffers(Display * dpy, GLXDrawable draw) {
if (!c) {
ods("Current context is: %p", ctx);
- clock_t t = clock();
- float elapsed = static_cast<float>(t - ctx->timeT) / CLOCKS_PER_SEC;
- ++(ctx->frameCount);
- if (elapsed > OVERLAY_FPS_INTERVAL) {
- OverlayMsg om;
- om.omh.uiMagic = OVERLAY_MAGIC_NUMBER;
- om.omh.uiType = OVERLAY_MSGTYPE_FPS;
- om.omh.iLength = sizeof(OverlayMsgFps);
- om.omf.fps = ctx->frameCount / elapsed;
-
- sendMessage(om);
-
- ctx->frameCount = 0;
- ctx->timeT = t;
- }
-
c = (Context *) malloc(sizeof(Context));
if (!c) {
ods("malloc failure");