Jump to content
  • Advertisement
Sign in to follow this  
vince35

new AA, same textures

This topic is 3792 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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 window
WNDCLASS 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 multisampling
HDC hDC2 = GetDC(hWnd);
PixelFormat = wglChoosePixelFormatARB(hDC2,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
wglMakeCurrent(NULL,NULL);

// Delete temp window
wglDeleteContext(hRC);
ReleaseDC(hWnd,hDC);
DestroyWindow(hWnd);
UnregisterClass(_T("OpenGL"),hInstance);

// Create multisample window
RegisterClass(&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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.)?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!