Advertisement Jump to content
Sign in to follow this  
Yours3!f

OpenGL linux opengl display fps (fraps like)

This topic is 1835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there,

 

so I'm writing an fps display tool for linux games using the instanced font rendering lib I wrote.

here's the current code:

https://github.com/Yours3lf/linux_gl_fps/blob/master/main.cpp

 

my experience so far has been that it works for my own demos/prototypes, but it fails to work on my own engine (I get a SIGBUS on the font draw call, which indicates that there's no context???)

however it did work on a unity game: http://www.desura.com/games/one-late-night

which is a great sign smile.png

I'm also having problems with sdl based games like xonotic etc.

the issue is that the MY glXSwapBuffers doesn't really get called for some reason. (I dunno if sdl calls it anytime at all...)

also steam games are 32 bit mostly, so I still need to test them with a 32 bit build.

 

Is there an alternative way to do buffer swapping on linux besides glx? (something that sdl might use?)

or am I doing something wrong?

 

EDIT: so I tried to run steam games, turns out you it isn't really that easy to run them from command line, but I did manage to run receiver (unity based again). Plus steam seems to be based on opengl/glx so in every window you get the fps counter biggrin.png

EDIT2: ok I figured out how to launch steam games from steam, you just need to set the launch options for the games like this:

LD_PRELOAD="/home/[user_name]/.linux_gl_fps/liblinux_gl_fps.so.32" %command%

it still doesn't seem to work for some games

EDIT3: soo it seems like the guys at sdl did it a bit curiously (for 1.2.15), they're not calling the glXSwapBuffers function directly, but they're querying it using dlsym, and then they're calling the pointer stored. Of course they're not querying using RTLD_NEXT, but actually opening the .so file, so it's not the correct (actual) function that is getting stored. Sooo I had to override SDL_GL_SwapBuffers too, and it seems to work now. Gotta test some.

EDIT4:

works: world of goo, unity based games, chromium-bsu, neverball, vertigo, amnesia, red eclipse, world-of-padman, xonotic, cube2 sauerbraten, cube2 metalheart, cube2 metalheart2 combat squared

doesn't work probably because of steam overlay: metro last light (it seems to use glxswapbuffers, but I fear that it uses it the same way as SDL does), source-engine based games (they seem to be using SDL)

doesn't work: alien-arena (seems to be using xfree86, like what the hell, this is the third buffer swapping lib... srsly ), penumbra ep1 (probably libstdc++ version mismatch), mars a ridiculous shooter (probably sfml .so version mismatch), overgrowth (a204)

glitchy: stuntrally (the menu works, but in the game the fps is in the car window reflection, which is cool but not what I wanted biggrin.png )

EDIT5: I added a simple outline by drawing the text again one pixel below and to the right smile.png

EDIT6: about source games; this is what I get for ldd-ing them:
 

$$$ ldd hl2_linux 
linux-gate.so.1 =>  (0xf76e7000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7688000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7680000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf7598000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7578000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf73c8000)
/lib/ld-linux.so.2 (0xf76e8000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf73a8000)

soo they probably link statically to everything except c / c++. Probably because of cheat protection or something like that.

 

best regards,

Yours3!f

Edited by Yours3!f

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!