|
|
@ -55,15 +55,8 @@ def set_drawing_context(ctx): |
|
|
|
""" |
|
|
|
""" |
|
|
|
global __current_context |
|
|
|
global __current_context |
|
|
|
|
|
|
|
|
|
|
|
print("CALLING SET DRAWING CONTEXT: {}".format(ctx)) |
|
|
|
|
|
|
|
__current_context = ctx |
|
|
|
__current_context = ctx |
|
|
|
|
|
|
|
|
|
|
|
print("WIDTH OF OPENGL WINDOW: {}".format(__WIDTH)) |
|
|
|
|
|
|
|
print("HEIGHT OF OPENGL WINDOW: {}".format(__HEIGHT)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("SETTING: {}".format(__current_context)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_drawing_mode(mode): |
|
|
|
def set_drawing_mode(mode): |
|
|
|
""" |
|
|
|
""" |
|
|
@ -79,7 +72,6 @@ def set_drawing_mode(mode): |
|
|
|
global __current_context |
|
|
|
global __current_context |
|
|
|
global __current_mode |
|
|
|
global __current_mode |
|
|
|
|
|
|
|
|
|
|
|
print("SET DRAWING MODE CONTEXT: {}".format(__current_context)) |
|
|
|
|
|
|
|
if __current_context is None: |
|
|
|
if __current_context is None: |
|
|
|
raise InvalidStateError("Drawing context must be set before setting " + |
|
|
|
raise InvalidStateError("Drawing context must be set before setting " + |
|
|
|
"drawing mode") |
|
|
|
"drawing mode") |
|
|
@ -87,12 +79,8 @@ def set_drawing_mode(mode): |
|
|
|
if not isinstance(mode, Mode): |
|
|
|
if not isinstance(mode, Mode): |
|
|
|
raise ValueError("Mode in set_drawing_mode must be of type Mode") |
|
|
|
raise ValueError("Mode in set_drawing_mode must be of type Mode") |
|
|
|
|
|
|
|
|
|
|
|
print("CALL FROM SET_DRAWING_MODE(MODE = {})".format(mode)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__current_mode = mode |
|
|
|
__current_mode = mode |
|
|
|
|
|
|
|
|
|
|
|
print("SET LOCALS (CURRENT MODE: {})".format(__current_mode)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_drawing_event(event): |
|
|
|
def set_drawing_event(event): |
|
|
|
""" |
|
|
|
""" |
|
|
@ -107,13 +95,9 @@ def set_drawing_event(event): |
|
|
|
raise InvalidStateError("Drawing context must be set before setting " + |
|
|
|
raise InvalidStateError("Drawing context must be set before setting " + |
|
|
|
"drawing mode") |
|
|
|
"drawing mode") |
|
|
|
|
|
|
|
|
|
|
|
print("CALL FROM SET_DRAWING_EVENT(event = {})".format(event)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if event is not None: |
|
|
|
if event is not None: |
|
|
|
__current_event = event |
|
|
|
__current_event = event |
|
|
|
|
|
|
|
|
|
|
|
print("SET LOCALS (CURRENT EVENT: {})".format(__current_event)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_gl(): |
|
|
|
def initialize_gl(): |
|
|
|
""" |
|
|
|
""" |
|
|
@ -175,7 +159,6 @@ def __clamp_x(x): |
|
|
|
@returns The clamped x coordinate. |
|
|
|
@returns The clamped x coordinate. |
|
|
|
""" |
|
|
|
""" |
|
|
|
x_w = (x / (__WIDTH / 2.0) - 1.0) |
|
|
|
x_w = (x / (__WIDTH / 2.0) - 1.0) |
|
|
|
print(x_w) |
|
|
|
|
|
|
|
return x_w |
|
|
|
return x_w |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -188,7 +171,6 @@ def __clamp_y(y): |
|
|
|
@returns The clamped y coordinate. |
|
|
|
@returns The clamped y coordinate. |
|
|
|
""" |
|
|
|
""" |
|
|
|
y_w = -1.0 * (y / (__HEIGHT / 2.0) - 1.0) |
|
|
|
y_w = -1.0 * (y / (__HEIGHT / 2.0) - 1.0) |
|
|
|
print(y_w) |
|
|
|
|
|
|
|
return y_w |
|
|
|
return y_w |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -215,8 +197,6 @@ def draw_points(x, y, color): |
|
|
|
|
|
|
|
|
|
|
|
ct = COLOR_TO_RGBA[color] |
|
|
|
ct = COLOR_TO_RGBA[color] |
|
|
|
|
|
|
|
|
|
|
|
print("DRAW POINT - DRAWING WITH COLOR {}".format(ct)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glViewport(0, 0, __WIDTH, __HEIGHT) |
|
|
|
glViewport(0, 0, __WIDTH, __HEIGHT) |
|
|
|
glPointSize(__POINT_SIZE) |
|
|
|
glPointSize(__POINT_SIZE) |
|
|
|
glColor4f(ct[0], ct[1], ct[2], ct[3]) |
|
|
|
glColor4f(ct[0], ct[1], ct[2], ct[3]) |
|
|
|