Search Results

Search found 2 results on 1 pages for 'user209347'.

Page 1/1 | 1 

  • OpenGL extension vs OpenGL core

    - by user209347
    I was doubting: I'm writing a cross-platform engine OpenGL C++, I figured out windows forces the developers to access OpenGL features above 1.1 through extensions. Now the thing is, on Linux, I know that I can directly access functions if the version supports it through glext.h and opengl version. The problem is that if on Linux, the core doesn't support it, is it possible there is an extensions that supports the same functionality, in my case vertex buffer objects? I'm doing something like this: Windows: (hashdeck) define glFunction functionpointer_to_the_extension (apparently the layout changes font size if I use #) Linux: Since glext already defined glFunction, I can write in client code glFunction, and compile it both on Windows AND Linux without changing a single line in my client code using the engine (my goal). Now the thing is, I saw a tutorial use only the extension on Linux, and not checking for the opengl implementation version. If the functionality is available in the core, is it also available as extension (VBO's e.g.)? Or is an extension something you never know is available? I want to write an engine that gets all the possibilities on hardware, so I need to check (on Linux) for extensions as well as core version for possible functionality implementation.

    Read the article

  • Modern OpenGL context failure [migrated]

    - by user209347
    OK, I managed to create an OpenGL context with wglcreatecontextattribARB with version 3.2 in my attrib struct (So I have initialized a 3.2 opengl context). It works, but the strange thing is, when I use glBindBuffer e,g. I still get unreferenced linker error, shouldn't a newer context prevent this? I'm on windows BTW, Linux doesn't have to deal with older and newer contexts (it directly supports the core of its version). The code: PIXELFORMATDESCRIPTOR pfd; HGLRC tmpRC; int iFormat; if (!(hDC = GetDC(hWnd))) { CMsgBox("Unable to create a device context. Program will now close.", "Error"); return false; } ZeroMemory(&pfd, sizeof(pfd)); pfd.nSize = sizeof(pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = attribs->colorbits; pfd.cDepthBits = attribs->depthbits; pfd.iLayerType = PFD_MAIN_PLANE; if (!(iFormat = ChoosePixelFormat(hDC, &pfd))) { CMsgBox("Unable to find a suitable pixel format. Program will now close.", "Error"); return false; } if (!SetPixelFormat(hDC, iFormat, &pfd)) { CMsgBox("Unable to initialize the pixel formats. Program will now close.", "Error"); return false; } if (!(tmpRC=wglCreateContext(hDC))) { CMsgBox("Unable to create a rendering context. Program will now close.", "Error"); return false; } if (!wglMakeCurrent(hDC, tmpRC)) { CMsgBox("Unable to activate the rendering context. Program will now close.", "Error"); return false; } strncpy(vers, (char*)glGetString(GL_VERSION), 3); vers[3] = '\0'; if (sscanf(vers, "%i.%i", &glv, &glsubv) != 2) { CMsgBox("Unable to retrieve the OpenGL version. Program will now close.", "Error"); return false; } hRC = NULL; if (glv > 2) // Have OpenGL 3.+ support { if ((wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"))) { int attribs[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, glv, WGL_CONTEXT_MINOR_VERSION_ARB, glsubv,WGL_CONTEXT_FLAGS_ARB, 0,0}; hRC = wglCreateContextAttribsARB(hDC, 0, attribs); wglMakeCurrent(NULL, NULL); wglDeleteContext(tmpRC); if (!wglMakeCurrent(hDC, hRC)) { CMsgBox("Unable to activate the rendering context. Program will now close.", "Error"); return false; } moderncontext = true; } } if (hRC == NULL) { hRC = tmpRC; moderncontext = false; }

    Read the article

1