pyopengl - Pyglet : Alternative to avoid slow FPS when writing text? -


i need display text on screen without dropping frames, @ 120 hz. code working fine until put on text (menu options), drops 47 hz. know problem amount of text displaying. thought writing text in texture , display static image, don't know if it's possible. it? if how?

i new opengl, started read red book (7th edition), still trying understand how works. code needs cross platform , can use pyopengl / pyglet. help/ advise appreciated. help.

def on_draw(dt):     left = true     right = false     rval = 0.0/255.0     gval = 153.0/255.0     bval = 0.0/255.0      shapeposition()      glclear(gl_color_buffer_bit)     glloadidentity()     drawchecker(nbr = 16, dark = 25.0/255, light = 75.0/255)      if screenswap == 1:         drawquestionmark(rval, gval, bval, left)          # blue line         blueline(left)          # line see if dropping frame         dropframetest(left)         pyglet.text.label('left', font_name='times new roman', font_size=34, x=(window.width*0.753), y= (window.height*0.05), anchor_x='left', anchor_y='center', color = (255, 0, 0, 150)).draw()         screenswap = 0      else:              drawquestionmark(rval, gval, bval, right)          # blue line         blueline(right)          # line see if dropping frame         dropframetest(right)         pyglet.text.label('right', font_name='times new roman', font_size=34, x=(window.width*0.877), y= (window.height*0.05), anchor_x='left', anchor_y='center', color = (0, 255, 0, 150)).draw()         screenswap = 1      fps = math.ceil(pyglet.clock.get_fps())     labelstr = str(int(fps))+' hz'     pyglet.text.label(labelstr, font_name='times new roman', font_size=36, x=(window.width*0.02), y= (window.height*0.05), anchor_x='left', anchor_y='center', color = (250, 250, 250, 150)).draw()          if menu:         in range(len(labelsysinfo)): # labelsysinfo list of 8 strings of text             pyglet.text.label(labelsysinfo[i], font_name='times new roman', font_size=18, x=(window.width*0.75) , y= (window.height*0.95)-(i*window.height*0.03), anchor_x='left', anchor_y='center', color = (210, 210, 255, 255)).draw() 

thanks katzwinkel, code running @ decent frame rate. kept label objects , updated them when there change.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -