Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8939921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:55:28+00:00 2026-06-15T10:55:28+00:00

I’m writing some OpenGL 3 program on C++, and now i have an issue

  • 0

I’m writing some OpenGL 3 program on C++, and now i have an issue on my laptop Lenovo Thinkpad e320 (Intel HD Graphics 3000). It works fine on my PC (ATI Radeon HD 5870).

Code near the error is following:

bool GLWindowCreate(const char *title, int width, int height, bool fullScreen){
...
    g_hRC = wglCreateContextAttribsARB(g_hDC, 0, attribs);
    if (!g_hRC || !wglMakeCurrent(g_hDC, g_hRC))
    {
        LOG_ERROR("Creating render context fail (%d)\n", GetLastError());
        return false;
    }
...
}

All compiles fine and i saw this error in log file.

I’m using Windows 8 (both on PC and laptop). Graphic card on laptop supports OpenGL 3. I have found some answer about same problem that i need to turn off hardware acceleration, but it seems there is no way to do this in Win 8.

Added:

Whole window create function:

bool GLWindowCreate(const char *title, int width, int height, bool fullScreen)
{
    ASSERT(title);
    ASSERT(width > 0);
    ASSERT(height > 0);

    WNDCLASSEX            wcx;
    PIXELFORMATDESCRIPTOR pfd;
    RECT                  rect;
    HGLRC                 hRCTemp;
    DWORD                 style, exStyle;
    int                   x, y, format;

    memset(&g_window, 0, sizeof(g_window));

    memset(&g_input, 0, sizeof(g_input));

    PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;

    // attributes for OpenGL context
    int attribs[] =
    {
        WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
        WGL_CONTEXT_MINOR_VERSION_ARB, 3,
        WGL_CONTEXT_FLAGS_ARB,         WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
        WGL_CONTEXT_PROFILE_MASK_ARB,  WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
        0
    };

    // timer init
    QueryPerformanceFrequency(&g_qpc);
    ASSERT(g_qpc.QuadPart > 0);

    g_timerFrequency = 1.0 / g_qpc.QuadPart;

    g_hInstance = (HINSTANCE)GetModuleHandle(NULL);

    memset(&wcx, 0, sizeof(wcx));
    wcx.cbSize        = sizeof(wcx);
    wcx.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
    wcx.lpfnWndProc   = (WNDPROC)GLWindowProc;
    wcx.hInstance     = g_hInstance;
    wcx.lpszClassName = GLWINDOW_CLASS_NAME;
    wcx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wcx.hCursor       = LoadCursor(NULL, IDC_ARROW);

    if (!RegisterClassEx(&wcx))
    {
        LOG_ERROR("RegisterClassEx fail (%d)\n", GetLastError());
        return false;
    }

    style   = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
    exStyle = WS_EX_APPWINDOW;

    x = (GetSystemMetrics(SM_CXSCREEN) - width)  / 2;
    y = (GetSystemMetrics(SM_CYSCREEN) - height) / 2;

    rect.left   = x;
    rect.right  = x + width;
    rect.top    = y;
    rect.bottom = y + height;

    AdjustWindowRectEx (&rect, style, FALSE, exStyle);

    // creating window
    g_hWnd = CreateWindowEx(exStyle, GLWINDOW_CLASS_NAME, title, style, rect.left, rect.top,
        rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, g_hInstance, NULL);

    if (!g_hWnd)
    {
        LOG_ERROR("CreateWindowEx fail (%d)\n", GetLastError());
        return false;
    }

        // get window descriptor
    g_hDC = GetDC(g_hWnd);

    if (!g_hDC)
    {
        LOG_ERROR("GetDC fail (%d)\n", GetLastError());
        return false;
    }

    memset(&pfd, 0, 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 = 32;
    pfd.cDepthBits = 24;

    // get pixel format
    format = ChoosePixelFormat(g_hDC, &pfd);
    if (!format || !SetPixelFormat(g_hDC, format, &pfd))
    {
        LOG_ERROR("Setting pixel format fail (%d)\n", GetLastError());
        return false;
    }

    // creating temp context
    // to get wglCreateContextAttribsARB function
    hRCTemp = wglCreateContext(g_hDC);
    if (!hRCTemp || !wglMakeCurrent(g_hDC, hRCTemp))
    {
        LOG_ERROR("Сreating temp render context fail (%d)\n", GetLastError());
        return false;
    }

    OPENGL_GET_PROC(PFNWGLCREATECONTEXTATTRIBSARBPROC, wglCreateContextAttribsARB);

    // delete temp context
    wglMakeCurrent(NULL, NULL);
    wglDeleteContext(hRCTemp);

    // creating OpenGL 3 context
    g_hRC = wglCreateContextAttribsARB(g_hDC, 0, attribs);
    if (!g_hRC || !wglMakeCurrent(g_hDC, g_hRC))
    {
        LOG_ERROR("Creating render context fail (%d)\n", GetLastError());
        return false;
    }

    int major, minor;
    glGetIntegerv(GL_MAJOR_VERSION, &major);
    glGetIntegerv(GL_MINOR_VERSION, &minor);
    LOG_DEBUG("OpenGL render context information:\n"
        "  Renderer       : %s\n"
        "  Vendor         : %s\n"
        "  Version        : %s\n"
        "  GLSL version   : %s\n"
        "  OpenGL version : %d.%d\n",
        (const char*)glGetString(GL_RENDERER),
        (const char*)glGetString(GL_VENDOR),
        (const char*)glGetString(GL_VERSION),
        (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION),
        major, minor
    );

    if (!OpenGLInitExtensions())
        return false;

    GLWindowSetSize(width, height, fullScreen);

    return true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:55:29+00:00Added an answer on June 15, 2026 at 10:55 am

    I have accidentally found a decision. Problem was there:

    int attribs[] =
        {
            WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
            WGL_CONTEXT_MINOR_VERSION_ARB, 3,
            WGL_CONTEXT_FLAGS_ARB,         WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
            WGL_CONTEXT_PROFILE_MASK_ARB,  WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
            0
        };
    

    Intel HD Graphics 3000 supports only OpenGL 3.1, not 3.3, so i have had to change

    WGL_CONTEXT_MINOR_VERSION_ARB, 3,
    

    to

    WGL_CONTEXT_MINOR_VERSION_ARB, 1,
    

    Thanks everyone and sorry for worry, hope my problem solution will help someone

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.