From: Pete Woodward Woodward (pww1++at++dcs.qmul.ac.uk)
Date: 06/19/2003 05:22:05
Sorry for the slighly disjointed message, my mailer dispatched the message
before it was complete...honestly !!
What I meant to say was that I use Performer 3.01 with C++ on .NET on
the XP platform.
When Performer starts with an Win32 OpenGL window I get the following
warning/error. The OpenGL geometry appears but the colour seems to be
off-grey (I just draw a white triangle)
The code is show in detail below (also for other people to use if they
want).
Additionally, I've downloaded the MFCPerformer application that was posted
here a week or two ago. This uses a straight Performer (rather than
OpenGL) window. And an identical error also appears. Again in this case
the geomtry seems to be shown. (Look like USS Enterprise to me, Scotty !)
But I don't know if the colour is wrong on this too.
Following Warning occurs at runtime:-
WGL Message:System Error: (13):wglGetPixelFormatAttribARB: WGLERR_INVALID_DATA
WGL Message:System Error: (13):wglGetPixelFormatAttribARB: WGLERR_INVALID_DATA
WGL Message:System Error: (13):wglGetPixelFormatAttribARB: WGLERR_INVALID_DATA
Exactly the same error occurs on the MFCPerformer application that uses MFC with a
Performer rather than OPENGL Window.
--------- CODE SAMPLE SHOWING Win32 OpenGL Performer Window------
The mechanism is is follows:-
A) First set up open gl win32 window:-
A1) make window drawing style info (DWORD) and window size rectangle(RECT)
configure WNDCLASS structure (message handle functions, window config...)
A2) Register window class, and then create top level window:-
hWnd=CreateWindowEx(....)
B) Configure window and extract drawing contexts
[The best config (i.e. native hardware) seems to be the following:- (from wglinfo)]
/* Vis Vis Driver Render buff lev render DB ste color buf aux dep ste accum buf MS MS */
/* ID Dep Type Type size els type reo r g b a buf th ncl r g b a num bufs */
/* ----------------------------------------------------------------------------------------------- */
/* 0x 6 32 Hardware W.. 32 0 rgba y . 8 8 8 8 . 24 8 16 16 16 16 . . */
B1) setup window pixel parameters PIXELFORMATDESCRIPTOR (pfd)
// pixel buffer properties
DWORD pixflags= PFD_DRAW_TO_WINDOW | /* draw to window or device surface */
PFD_SUPPORT_OPENGL | /* support opengl drawing */
PFD_DOUBLEBUFFER; /* the buffer is double buffered */
pfd.dwFlags // pixel buffer properties
pfd.iPixelType = PFD_TYPE_RGBA;//// RGBA or Colour Indexed
...
bits per pixel, bitplane size, alpha,accum buffer settings etc.
B2) get openGL device context from window handle (i.e. from CreateWindowEx() )
hDC=GetDC(hWnd)
B3) grab a OpenGL matching pixel format from device context
win32Data->PixelFormat=ChoosePixelFormat(hDC,&(pfd) )
B4) set pixel format on device context
SetPixelFormat(hDC,PixelFormat, &(pfd))
B5) get an instance rendering context for this windows device context
hRC=wglCreateContext(hDC)
B6) make RC calling thread's current RC through which all GL commands pass
wglMakeCurrent(hDC,hRC)
C) Initialize Performer and Associate Render Context to Window
C1) Performer initialize/device pipeline config
pfInit();pfConfig();
pfPipe *pipe= pfGetPipe(0);
pfChannel *pcam0 = new pfChannel(pipe);
pfPipeWindow *pwin0 = new pfPipeWindow(pipe);
// use window size rectangle(RECT) for size
pwin0->setOriginSize(0,0,windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top);
C2) Preconfigure OpenGL Performer window
pwin0->setGLCxt(hRC); //set window OpenGL (rather than X) pfGLContext
pwin0->setWinType(PFPWIN_TYPE_PBUFFER); // set PBuffer window type ?
pwin0->setFBConfig(PixelFormat); // use openGL pixel format
pwin0->setWSDrawable(hInst,hWnd);
pwin0->open();
pfFrame();
D) Setup OpenGL view
D1) (projection) settings for new window
D2) initialize window shading config and draw
D3) In windows event loop draw scene and swap buffer
drawGLScene
SwapBuffers(hDC);
This archive was generated by hypermail 2b29 : Thu Jun 19 2003 - 06:20:51 PDT