OpenGL commands

OpenGL commands

Anonymous
Not applicable
278 Views
2 Replies
Message 1 of 3

OpenGL commands

Anonymous
Not applicable
Hello!

I would like to draw to Inventor view using my own OpenGL commands with C++. For example I would like to draw s single polygon using glVertex3f(...) OpenGL function. Can anybody tell me how to draw to Inventor display using OpenGL commands? (I can not use Inventor own graphical primitives for my purposes and I have to use pure OpenGL commands)

I have made following code that initializes my OpenGL context (m_pApplication is pointer to Application object):

// Find out hWnd to current view window
CComPtr pActiveView;
m_pApplication->get_ActiveView(&pActiveView);
pActiveView->get_HWND((long*)&hWnd);

// get the device context (DC)
hDC = GetDC( hWnd );

// Create new device context
hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC);

Then I try to draw using OpenGL commands:

glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0);
glVertex3f(.5, 0, 0);
glColor3f(0, 1, 0);
glVertex3f(0, .5, 0);
glColor3f(0, 0, 1);
glVertex3f(-.5, 0, 0);
glEnd();
SwapBuffers(hDC);

I can not get any OpenGL primitives visible into Inventor view display. Even if I try to clear current view using glClear it seems not to happen.

Can you tell me how to draw into Inventor display using OpenGL commands?

Regards,

Janne Hietanen
0 Likes
279 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Are you aware of the Client Graphics functions in the API? -- Kent Autodesk Discussion Group Facilitator "jhietanen" wrote in message news:9501092.1078742714956.JavaMail.jive@jiveforum1.autodesk.com... > Hello! > > I would like to draw to Inventor view using my own OpenGL commands with C++.
0 Likes
Message 3 of 3

Anonymous
Not applicable
I am aware of ClientGraphis. I am just wondering if ClientGraphics objects are flexible enough for me. I should be able to change object's index-list in real-time when display updates.

- Janne
0 Likes