new AA, same textures

Started by
4 comments, last by V-man 16 years, 2 months ago
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.
Advertisement
If you have some other GL context with which you have called wglShareList().
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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.

// 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.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement