PDA

View Full Version : Unable to get WGL_ARB_extensions_string >_<



RoiiG
07-13-2010, 01:42 PM
Well.. i'm trying to create a window and use opengl > 3.0 but i'm failing hard.

I'm following the tutorial from the opengl wiki
http://www.opengl.org/wiki/OpenGL_3.0_and_beyond%2C_creating_a_context

But no... i'm stuck here:

The first step here is to check to see if WGL_ARB_extensions_string is an extension defined by OpenGL. You can use glGetString(GL_EXTENSIONS) to do this; this will return a space-separated list of strings. Parse this list and check to see if "WGL_ARB_extensions_string" is there.

If it is not defined, stop.

So i stop here in the forums. I have this code:


void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
{

PIXELFORMATDESCRIPTOR pfd ={
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags
PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette.
32, //Colordepth of the framebuffer.
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
24, //Number of bits for the depthbuffer
8, //Number of bits for the stencilbuffer
0, //Number of Aux buffers in the framebuffer.
PFD_MAIN_PLANE,
0,
0, 0, 0
};

int format;

// get the device context (DC)
*hDC = GetDC( hWnd );

// set the pixel format for the DC

format = ChoosePixelFormat( *hDC, &amp;pfd );
SetPixelFormat( *hDC, format, &amp;pfd );
// create and enable the render context (RC)
*hRC = wglCreateContext( *hDC );
wglMakeCurrent( *hDC, *hRC );


//Mirem
std::vector<std::string> extensions; //on guardarem les extensions
const GLubyte *ext= glGetString(GL_EXTENSIONS); //mirem quines tenim disponibles

int i=0;
std::string buffer;
while(ext!=0 &amp;&amp; ext[i]!='\n')
{
if(ext[i]==' ')
{
extensions.push_back(buffer);
buffer.clear();
}
else
{
buffer.push_back(ext[i]);
}
i++;
}
.
.
.


glGetString(GL_EXTENSIONS) returned 191 Extensions available, but the WGL_ARB_extensions_string is not there. I'm doing something wrong, can you help me?

Ah, i have the latest Nvidia drivers, and a Geforce 8800 GTS, and if i run the OpenGL Extensions viewer i can see that i have support for opengl 3.3 and some 4.0 extensions.

Thanks

overlay
07-13-2010, 05:43 PM
http://www.opengl.org/registry/specs/ARB/wgl_extensions_string.txt

The spec says:

"Advertising WGL Extensions

Applications should call wglGetProcAddress to see whether or not
wglGetExtensionsStringARB is supported."


So you should not rely on glGetString() but directly call
wglGetProcAddress("wglGetExtensionsStringARB"). If the return
value is not null, then the extension is supported.

This is some kind of bootstrapping case.