bgl Hello Triangle Blank Screen

This code should draw the "Hello Triangle" (1) that everyone starts off with but it's not showing up. Since it's in Blender, I used (3) as a reference for when to draw. That's why the code itself does not include ClearColor because I assume Blender handles it before the draw() is called.

I've verified that the vertex buffer is filled with the correct positions by using glGetBufferSubData (code not shown). The shaders also compile without error logs. That leaves the draw call itself as the problem. I believe the render target is the 3DView because glClearColor() does change its color. It doesn't appear to be a culling problem because I've tested 3000 random verts over a [-10,10] 2D range along with turning culling off using glDisable(GL_CULL_FACE) but nothing shows. Of course, even if it did render, Blender's own UI rendering breaks after draw() finishes.. I'm not sure what I'm doing wrong. These problems apply to B2.79b and B2.80 as of the 3/21/19 build.

I have read the release notes (2) and I understand that its not advised to use bgl but it specifically advises against the the use of immediate mode and the fixed function pipeline, which isn't what I'm using.

Any and all help is greatly appreciated.

_

import bpy
from bgl import *
from sys import getsizeof

#version 330

layout(location = 0) in vec3 position;
void main()
{
gl_Position =  vec4(position,1.0);
}
"""

#version 330

out vec4 outputColor;
void main(){
outputColor = vec4(1.0, 1.0, 1.0, 1.0);
}
"""
theProgram = None

NULL_OBJ = Buffer(GL_INT,1,[0])

size = 1
positions = [0.75 * size, 0.75* size, 0.0* size,
0.75 * size, -0.75* size, 0.0* size,
-0.75* size, -0.75* size, 0.0* size]
vertexPositions_ptr = Buffer(GL_FLOAT,len(positions),positions)

#python doesnt support pointers, so we use bgl buffer objects instead
vertexBuffer = Buffer(GL_INT,1)

def init_vertex_buffer():
glGenBuffers(1,vertexBuffer)

#I verified that the buffer is written to with the vertices using glGetBufferSubData(code not shown)
glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer[0])
glBufferData(GL_ARRAY_BUFFER,getsizeof(vertexPositions_ptr),vertexPositions_ptr,GL_DYNAMIC_DRAW)

glBindBuffer(GL_ARRAY_BUFFER,0)

def init_program():

global theProgram

#the shaders appear to be created just fine, no error logs.
status = Buffer(GL_INT,1)
if status[0] == GL_FALSE:
infoLogLength = Buffer(GL_INT,1)

infoLog = Buffer(GL_BYTE,infoLogLength[0]+1)

del infoLog
del infoLogLength
del status

def buffer_to_string(buffer):
chars = []
for char in buffer.to_list():
chars.append(chr(char))
return ''.join(chars)

program = glCreateProgram()

status = Buffer(GL_INT,1)
if status[0] == GL_FALSE:
infoLogLength = Buffer(GL_INT,1)
glGetProgramiv(program,GL_INFO_LOG_LENGTH,infoLogLength)

infoLog = Buffer(GL_BYTE,infoLogLength[0]+1)
glGetProgramInfoLog(program,infoLogLength[0],infoLogLength,infoLog)

del infoLog
del infoLogLength
del status

return program

def draw():
glUseProgram(theProgram)

glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer[0])
glEnableVertexAttribArray(0);
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,12,NULL_OBJ)

#nothing shows and Blender's UI rendering breaks...
glDrawArrays(GL_TRIANGLES,0,3)

glDisableVertexAttribArray(0)
glUseProgram(0)
glBindBuffer(GL_ARRAY_BUFFER,0)

error = glGetError()
if error != 0:
print(glGetError())

init_program()
init_vertex_buffer()