From fe471e087f2edaf13b41b7f750203ab078867b0c Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 10 May 2011 01:51:17 -0400 Subject: [PATCH] configurable # of triangles in benchmarks --- benchmarks/pygame_random_triangles.py | 4 +++- benchmarks/pyglet_random_triangles.py | 4 +++- benchmarks/random_triangles | Bin 0 -> 13081 bytes benchmarks/random_triangles.c | 4 +++- demo/random_triangles.py | 4 +++- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 benchmarks/random_triangles diff --git a/benchmarks/pygame_random_triangles.py b/benchmarks/pygame_random_triangles.py index 9c1d48e..4164ce8 100644 --- a/benchmarks/pygame_random_triangles.py +++ b/benchmarks/pygame_random_triangles.py @@ -2,6 +2,8 @@ import pygame import time import random +N_TRIANGLES = 1000 + def main(): pygame.init() @@ -21,7 +23,7 @@ def main(): surface.fill((0,0,0)) - for i in xrange(1000): + for i in xrange(N_TRIANGLES): p1 = (random.randint(0,512), random.randint(0, 512)) p2 = (random.randint(0,512), random.randint(0, 512)) p3 = (random.randint(0,512), random.randint(0, 512)) diff --git a/benchmarks/pyglet_random_triangles.py b/benchmarks/pyglet_random_triangles.py index 8893507..f606272 100644 --- a/benchmarks/pyglet_random_triangles.py +++ b/benchmarks/pyglet_random_triangles.py @@ -3,6 +3,8 @@ from pyglet.gl import * import random import time +N_TRIANGLES = 1000 + window = pyglet.window.Window() frames = 0 @@ -21,7 +23,7 @@ def on_draw(): window.clear() glClear(GL_COLOR_BUFFER_BIT) glLoadIdentity() - for x in range(1000): + for x in range(N_TRIANGLES): glColor3ub(random.randint(0,255), random.randint(0,255), random.randint(0,255)) glBegin(GL_LINE_LOOP) glVertex2f(random.randint(0,512), random.randint(0,512)) diff --git a/benchmarks/random_triangles b/benchmarks/random_triangles new file mode 100755 index 0000000000000000000000000000000000000000..4497ab90b4cb22858c27f99f7659203196565718 GIT binary patch literal 13081 zcmeHNZ*WxA6~DWikbou|FiI3^R$ZLnG)urh*9!K9WZ}iG5FxZ!7+#j_h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~k$ZF@^Lg?u-k7@>nn~;oM1|_WzFn!_MpDP)VQSUWd@9d6Iqe{P&ymDUK$DKE++s z$9scW{~%!K6Cs|tZyXbWnCycHFT$#3&RsErP$zwYk*B>w7}B<-I#({@z;}Rk z!9V$p;tD>`<+Hz4OlZW^x!JyMCI8h1qjg)QS&cRrG2JJPjW!qw-T!j&lFajRE?&yU zt&$PqbsMZ!x(^u}ZE&Zh`%5lf&gj08i_c|rKgh-BWuBLF@!9!X*lvT!PjNX{z9N%% znv3Vj_u~E7AudWrQC_#fDyO(-Y_!4ZqIi~zFUaJB=Hk~t-03hvyl#V2MT#rNMjO0+ zP`t>+ugl~?<>Cu7?O=<^UMl(U$H>O z9mQ*E$L9?To9zcT$7lP&1GtsJTOQ=$7|S+bEG#>I+Bf$Lyidd_+K&mqv7cU3KZVAR z_az*^!}NPS!SVTQ#i_WdxXfetQdW3!D8rVjRW{#%j}ezAAuY zexxPO`dJ9L1Ku{x>)~d=^W}rC;&=tatSBrLuGR^ho@aO?Tz|^GX)L-vN9+%fk8nt1@IMs z&$rgFUa_9ZBR}ByH4Kx>jK$0QsbHACh6SHrv1|t%^JvZc9W(awjdQ<{f6Qc8DN z0{HJmKW4kfxqJn~{5mW=Hv{Mk9M2QyJAI*$AqAIpM%9=ahfKImNK0*Q-?&Nfwr+06 z%v_}~?)Bb{Yn!~v#&zp9 zd)k%urnO!Vjvrt26<;*!+sl(|a{!)y%#@b8XI zV{wsaEYuB-ERf5r%VR>ZF(r9cW^k^#SqaeJn3}A#ZiM0cgJC5e3-}Ew(3u2j#V|$e ze^y2`&uq@NWKyFQ#UG0(-Qf06fEES)Ks>)0y~4k# +#define N_TRIANGLES 1000 + int main(int argc, char **argv) { SDL_Init(SDL_INIT_EVERYTHING); @@ -37,7 +39,7 @@ int main(int argc, char **argv) { SDL_RenderClear(renderer); SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); - for(i=0; i < 20; ++i) { + for(i=0; i < N_TRIANGLES; ++i) { SDL_SetRenderDrawColor(renderer, rand()%255, rand()%255, rand()%255, 255); p1.x = rand()%512; p1.y = rand()%512; diff --git a/demo/random_triangles.py b/demo/random_triangles.py index d03a584..7e3de94 100755 --- a/demo/random_triangles.py +++ b/demo/random_triangles.py @@ -2,11 +2,13 @@ from demo_utils import simple_timed_loop import random +N_TRIANGLES = 1000 + def draw(window): window.renderer.set_draw_color(0,0,0,255) window.renderer.clear() window.renderer.set_draw_color(255,0,0,255) - for i in xrange(1000): + for i in xrange(N_TRIANGLES): window.renderer.set_draw_color(random.randint(0,255), random.randint(0,255), random.randint(0,255))