new AA, same textures
Hi,
Is there any way to change the anti-aliasing, lets say from 2x to 4x, after the textures have been loaded without having to reload them? Idem for the shaders, etc.
I tried looking on the web for wglShareLists, but it's very poorly documented, and I didn't any sample code on how to use it.
Here is what I currently do to create my window.
How Do I modify it if I want later on to change the number of samples in my multisampling? I know I have to redo the sections "Delete temp window" and "Create multisample window", but how do I use wglShareLists in this to make sure my textures and shaders aren't destroyed with my old window?
Thanks.
Here is what I currently do to create my window.
// create temp windowWNDCLASS wc;RegisterClass(&wc);AdjustWindowRectEx(&WindowRect, dwstyle, FALSE, dwExstyle);CreateWindowEx(...);hDC=GetDC(hWnd);PixelFormat=ChoosePixelFormat(hDC,&pfd);SetPixelFormat(hDC,PixelFormat,&pfd);hRC=wglCreateContext(hDC);wglMakeCurrent(hDC,hRC);// Initalize multisamplingHDC hDC2 = GetDC(hWnd);PixelFormat = wglChoosePixelFormatARB(hDC2,iAttributes,fAttributes,1,&pixelFormat,&numFormats);wglMakeCurrent(NULL,NULL);// Delete temp windowwglDeleteContext(hRC);ReleaseDC(hWnd,hDC);DestroyWindow(hWnd);UnregisterClass(_T("OpenGL"),hInstance);// Create multisample windowRegisterClass(&wc);AdjustWindowRectEx(&WindowRect, dwstyle, FALSE, dwExstyle);hWnd=CreateWindowEx(...);hDC=GetDC(hWnd);SetPixelFormat(hDC,PixelFormat,&pfd);hRC=wglCreateContext(hDC);wglMakeCurrent(hDC,hRC);ShowWindow(hWnd,SW_SHOW);{...}load textures render scene
How Do I modify it if I want later on to change the number of samples in my multisampling? I know I have to redo the sections "Delete temp window" and "Create multisample window", but how do I use wglShareLists in this to make sure my textures and shaders aren't destroyed with my old window?
Thanks.
I have never done it myself but the idea is to create another window that you will not destroy. Setup GL on that window.
Call wglShareLists(firstGLcontext, secondGLContext);
Now if you kill your main window and recreate a new one, call wglShareLists again.
I forget if it is the other way around
wglShareLists(secondGLContext, firstGLcontext);
since it could have an effect whether the function succeeds or not.
I have only used wglShareLists when I needed multiple windows open so I called it as soon as I created all the windows, before I allocated any GL resources like textures.
Call wglShareLists(firstGLcontext, secondGLContext);
Now if you kill your main window and recreate a new one, call wglShareLists again.
I forget if it is the other way around
wglShareLists(secondGLContext, firstGLcontext);
since it could have an effect whether the function succeeds or not.
I have only used wglShareLists when I needed multiple windows open so I called it as soon as I created all the windows, before I allocated any GL resources like textures.
I have to create a full window? Isn't it going to waste a lot a video memory for nothing (frame buffer, z-buffer, back buffer, etc.)?
You have to have a window since the RC is linked to it. Make it a small window. Maybe the driver will allocate a small framebuffer for it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement