Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm looking to get into 3d with OpenGL, using SDL to help with other stuff.

I found plenty of good tutorials (lazyfoo is a big one), but "Learning Modern 3d Graphics Programming" uses a newer version of openGL that I'm not able to run!

I opened up OpenGL extensions viewer, and I can only run OpenGL 2.0, whereas most tutorials are in higher versions.

I ask this because I've heard that just about everything in 2.* got depreciated in the newer versions, so I'm worried that my code might not work.

I'm looking at a few other tutorials, but I'm so used to SDL that those just confuse me...

So should I bother trying to do graphics programming now, or should I just wait until I can upgrade my computer?

share|improve this question
    
have you tried updating your drivers? check if your card supports OpenGL 3.x, it should if it was manufactured in the last like 4 years or something, even if it wasn't, there's a chance that new drives will let you use opengl 3.x even if it's not fully supported by the hardware –  dreta Jun 19 '12 at 18:47
    
Integrateed Intel from a while ago, new drivers had no effect on it, I can only get 2.0, the book I mentioned couldn't even run the tutorials because I couldn't support the latest version. –  thePalindrome Jun 19 '12 at 19:09
    
Indeed, Intel's drivers are notoriously bad in terms of GL support, both in terms of supported features as well as in terms of bugginess and performance. The need to support the large number of Intel users is alone a strong reason to use D3D for PC-only games, and to at least consider a dual-stack graphics for multi-platform games. –  Sean Middleditch Jun 19 '12 at 20:35
    
Also, most of GL 3+ is the exact same as GL 2. Many of the things that have been added are already available on GL 2 hardware via extensions, and the things that have been removed are largely the older GL 1.x functionality. Building an app that can take advantage of GL 3+ features while being compatible with GL 2.0 is quite possible, and some games do exactly that. –  Sean Middleditch Jun 19 '12 at 20:37
add comment

2 Answers

up vote 3 down vote accepted

Modern drivers / video cards are able to choose OpenGl implementations. Whether it's only using features described in these versions or setting it. So you should be fine going for 2.0 since majority of video cards support this version.

share|improve this answer
add comment

When you create an OpenGL window, you choose the context you want. Here's a possible way to do that on Windows (when creating a Win32 window):

HGLRC tempcontext = wglCreateContext(hDC);
wglMakeCurrent(hDC, tempcontext);

GLenum status = glewInit();
if (status != GLEW_OK)
{
    char error[256];
    sprintf(error, "%s", glewGetErrorString(status));
    MessageBoxA(NULL, error, "GLEW error", MB_OK | MB_ICONEXCLAMATION);
    return GL_FALSE;
}

int supported = wglewIsSupported("WGL_ARB_create_context");
if (supported == 1)
{
    LOG_INFORMATION("Creating OpenGL 3.1 context.");

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

    hRC = wglCreateContextAttribsARB(hDC, 0, attribs); CGLE();
    wglMakeCurrent(NULL, NULL);
    wglDeleteContext(tempcontext);
    wglMakeCurrent(hDC, hRC);
}
else
{
    LOG_INFORMATION("Creating OpenGL 2.1 context.");

    hRC = tempcontext;
}
share|improve this answer
    
That's one way to do it, but I'm using SDL, and the WinAPI really makes my head hurt, but thanks for the answer! –  thePalindrome Jun 19 '12 at 18:32
    
It's bad, but not as bad as you think. ;) Here's a simple Win32 window I copy-paste all the time: pastebin.com/7BAAeter –  knight666 Jun 19 '12 at 18:35
    
SDL 1.3 should support GL 3 Core contexts, iirc. Of course only in the cases where your OS/hardware/driver supports it. –  Sean Middleditch Jun 19 '12 at 20:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.