Want an OpenGL 2D example (VC++, draw a rectangle)

I want to create a high performace 2D program.

I'm using VC++2008. Suppose I have created the main window. What I want is to draw a red rectangle (top left: 10,20, bottom right: 200, 300) in the main window's client area like what FillRect() API does but using OpenGL.

void InitOpenGL(HWND hwnd)
{
.... // What should I do?
     // Only for 2D drawing, and the (0,0) should be the top left point.
}

// the function below will be called in the WM_PAINT handler
void DrawRectWithOpenGL(RECT* pRect)
{
.... // What should I do?
}

EDIT1: Does OpenGL have a 2D drawing API or lib like Direct2D/DirectWrite?

5
задан genpfault 4 May 2011 в 06:04
поделиться