BGL module help

I’m still learning Blender Python API
was trying to figure out how to work with “bgl” module and found this good example online (it is for v2.49)
any idea how to make it work on 2.65 or higher?

 import Blender
 from Blender.BGL import *
 from Blender import Draw
 R = G = B = 0
 A = 1
 title = "Testing BGL  + Draw"
 instructions = "Use mouse buttons or wheel to change the background color."
 quitting = " Press ESC or q to quit."
 len1 = Draw.GetStringWidth(title)
 len2 = Draw.GetStringWidth(instructions + quitting)
 #
 def show_win():
   glClearColor(R,G,B,A)                # define color used to clear buffers 
   glClear(GL_COLOR_BUFFER_BIT)         # use it to clear the color buffer
   glColor3f(0.35,0.18,0.92)            # define default color
   glBegin(GL_POLYGON)                  # begin a vertex data list
   glVertex2i(165, 158)
   glVertex2i(252, 55)
   glVertex2i(104, 128)
   glEnd()
   glColor3f(0.4,0.4,0.4)               # change default color
   glRecti(40, 96, 60+len1, 113)
   glColor3f(1,1,1)
   glRasterPos2i(50,100)                # move cursor to x = 50, y = 100
   Draw.Text(title)                     # draw this text there
   glRasterPos2i(350,40)                # move cursor again
   Draw.Text(instructions + quitting)   # draw another msg
   glBegin(GL_LINE_LOOP)                # begin a vertex-data list
   glVertex2i(46,92)
   glVertex2i(120,92)
   glVertex2i(120,115)
   glVertex2i(46,115)
   glEnd()                              # close this list
 #
 def ev(evt, val):                      # event callback for Draw.Register()
   global R,G,B,A                       # ... it handles input events
   if evt == Draw.ESCKEY or evt == Draw.QKEY:
     Draw.Exit()                        # this quits the script
   elif not val: return
   elif evt == Draw.LEFTMOUSE: R = 1 - R
   elif evt == Draw.MIDDLEMOUSE: G = 1 - G
   elif evt == Draw.RIGHTMOUSE: B = 1 - B
   elif evt == Draw.WHEELUPMOUSE:
     R += 0.1
     if R > 1: R = 1
   elif evt == Draw.WHEELDOWNMOUSE:
     R -= 0.1
     if R < 0: R = 0
   else:
     return                             # don't redraw if nothing changed
   Draw.Redraw(1)                       # make changes visible.
 #
 Draw.Register(show_win, ev, None)      # start the main loop

I think it has been renamed toblf.


import bpy, blf

class BFOsd():
    """Hackish on screen display"""
    _msg = ""
        
    def __init__(self):
        self._handle = bpy.types.SpaceView3D.draw_handler_add(self._draw_handler, tuple(), 'WINDOW', 'POST_PIXEL')
        
    def remove(self):
        if not self._handle: return
        bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)

    def _draw_handler(self):
        blf.position(0,70,30,0)
        blf.size(0,20,72)
        blf.draw(0,self._msg)
          
    def show(self,msg):
        self._msg = str(msg)
        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)

    def clean(self):
        self._msg = str()
        bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
        
# Global name
bf_osd = BFOsd()
bf_osd.show("This is the message")

well this worked,but some questions:
1- how to remove what I have drawn !!
2- what I actually want is draw a vertex array [assume it is a particle array] how to do this so for example i can rotate around them as if they are objects in 3d space

well to be more clear!!
what I actually want is to create a vertex buffer object (VBO) and draw it inside Blender
I can create it from C++ and use ctypes to connect data,but the main question is:how to draw it inside Blender??

or even better is creating that VBO inside Blender itself if possible

so I guess no one knows how to make a VBO inside Blender viewport??? no body heared about glDrawArrays???