configurable # of triangles in benchmarks
This commit is contained in:
parent
180328231d
commit
fe471e087f
@ -2,6 +2,8 @@ import pygame
|
|||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
N_TRIANGLES = 1000
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
|
||||||
@ -21,7 +23,7 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
surface.fill((0,0,0))
|
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))
|
p1 = (random.randint(0,512), random.randint(0, 512))
|
||||||
p2 = (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))
|
p3 = (random.randint(0,512), random.randint(0, 512))
|
||||||
|
@ -3,6 +3,8 @@ from pyglet.gl import *
|
|||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
N_TRIANGLES = 1000
|
||||||
|
|
||||||
window = pyglet.window.Window()
|
window = pyglet.window.Window()
|
||||||
|
|
||||||
frames = 0
|
frames = 0
|
||||||
@ -21,7 +23,7 @@ def on_draw():
|
|||||||
window.clear()
|
window.clear()
|
||||||
glClear(GL_COLOR_BUFFER_BIT)
|
glClear(GL_COLOR_BUFFER_BIT)
|
||||||
glLoadIdentity()
|
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))
|
glColor3ub(random.randint(0,255), random.randint(0,255), random.randint(0,255))
|
||||||
glBegin(GL_LINE_LOOP)
|
glBegin(GL_LINE_LOOP)
|
||||||
glVertex2f(random.randint(0,512), random.randint(0,512))
|
glVertex2f(random.randint(0,512), random.randint(0,512))
|
||||||
|
BIN
benchmarks/random_triangles
Executable file
BIN
benchmarks/random_triangles
Executable file
Binary file not shown.
@ -1,6 +1,8 @@
|
|||||||
#include "SDL/SDL.h"
|
#include "SDL/SDL.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define N_TRIANGLES 1000
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
SDL_Init(SDL_INIT_EVERYTHING);
|
SDL_Init(SDL_INIT_EVERYTHING);
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ int main(int argc, char **argv) {
|
|||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
|
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);
|
SDL_SetRenderDrawColor(renderer, rand()%255, rand()%255, rand()%255, 255);
|
||||||
p1.x = rand()%512;
|
p1.x = rand()%512;
|
||||||
p1.y = rand()%512;
|
p1.y = rand()%512;
|
||||||
|
@ -2,11 +2,13 @@
|
|||||||
from demo_utils import simple_timed_loop
|
from demo_utils import simple_timed_loop
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
N_TRIANGLES = 1000
|
||||||
|
|
||||||
def draw(window):
|
def draw(window):
|
||||||
window.renderer.set_draw_color(0,0,0,255)
|
window.renderer.set_draw_color(0,0,0,255)
|
||||||
window.renderer.clear()
|
window.renderer.clear()
|
||||||
window.renderer.set_draw_color(255,0,0,255)
|
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),
|
window.renderer.set_draw_color(random.randint(0,255),
|
||||||
random.randint(0,255),
|
random.randint(0,255),
|
||||||
random.randint(0,255))
|
random.randint(0,255))
|
||||||
|
Loading…
Reference in New Issue
Block a user