hmm, there are a few demo programs for OpenGL on the net - some use stencil buffers. I would suggest you download one of them and compare your code to it. Maybe also try this 'debug message spam' about the config in one of these demo programs to go sure stencil buffer is reported correctly. Does it work with 16-bit at all?
I tried this is the Initialisise function and in a dll entry point:
void GL_Spawn() { PIXELFORMATDESCRIPTOR pfd;
g_hRC = wglGetCurrentContext(); g_hDC = wglGetCurrentDC();
// get the current pixel format index int iPixelFormat = GetPixelFormat(g_hDC); DescribePixelFormat(g_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
wglMakeCurrent( g_hDC, NULL );
// sort out the old, evil render context... if( g_hRC != NULL ) { wglDeleteContext( g_hRC ); g_hRC = NULL; }
// modify our pixel format O_O pfd.cStencilBits = 1;
// set our modified pixel format iPixelFormat = ChoosePixelFormat( g_hDC, &pfd ); SetPixelFormat( g_hDC, iPixelFormat, &pfd);
// create a new render context! g_hRC = wglCreateContext( g_hDC ); wglMakeCurrent( g_hDC, g_hRC ); }
because i didnt have any stencil buffer code to try out I made a client command to use the DescribePixFormat again and tell me some details about the setup...
void GL_ConDump() { PIXELFORMATDESCRIPTOR pfd; DescribePixelFormat(g_hDC, GetPixelFormat(g_hDC), sizeof(PIXELFORMATDESCRIPTOR), &pfd);
// useless facts to dump to console :) char *vendor = (char*)glGetString(GL_VENDOR); char *renderer = (char*)glGetString(GL_RENDERER); char *version = (char*)glGetString(GL_VERSION);
// dump to console a list detailing requested extensions... gEngfuncs.Con_Printf("Dumping OpenGL Data...\n");
gEngfuncs.Con_Printf("----------------------------------------------------
------------\n"); // snip out version/vendor printout...
gEngfuncs.Con_Printf("----------------------------------------------------
------------\n"); gEngfuncs.Con_Printf("Stencil Bits %d\n", pfd.cStencilBits); gEngfuncs.Con_Printf("Depth Bits %d\n", pfd.cDepthBits); gEngfuncs.Con_Printf("Color Bits: %d\n", pfd.cColorBits);
gEngfuncs.Con_Printf("----------------------------------------------------
------------\n"); // snip out extension checks...
gEngfuncs.Con_Printf("----------------------------------------------------
------------\n\n");
}
Depth and Color are reported as 16 but the stencil bit is still 0 O_O... If I call the GL_Spawn from the huds init or vidinit then i get a white screen or a white console so the context is getting messed around with... any ideas?
Marco Leise wrote:
And anyway, it is teh stencil buffer!!! Imagine all the things you can do with it. Even if it seems to be unsafe ther MUST be a way. Looking forward to some freaking realtime shadows. What's the mod?
Is that safe O_O?
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

