FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

reload loads 3.3 instead of 4.2

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
dav1d



Joined: 12 Sep 2011
Posts: 40

PostPosted: Fri Feb 17, 2012 1:32 pm    Post subject: reload loads 3.3 instead of 4.2 Reply with quote

Derelict3GL.reload() loads the wrong OpenGL version.

Code:
GLFWwindow open_glfw_win(int width, int height) {
    foreach(v; oglvt) {
        debug writefln("Trying OpenGL version: %s.%s", v.major, v.minor);
        glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, v.major);
        glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, v.minor);
        glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwOpenWindowHint(GLFW_WINDOW_RESIZABLE, GL_FALSE);
       
        _window = glfwOpenWindow(width, height, GLFW_WINDOWED, "BraLa", null);
        if(_window) {
            break;
        }
    }
   
    debug {} else { glfwSetInputMode(_window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED); }
       
    glfwSwapInterval(0); // change this to 1?
   
    return _window;
}

GLVersion init_opengl() {
    return DerelictGL3.reload();
}

void main() {
    debug writefln("init: %dx%d", width, height);
    GLFWwindow win = open_glfw_win(width, height);
   
    writefln("%s", to!string(glGetString(GL_VERSION)));
    GLVersion glv = init_opengl();
    debug writefln("OpenGL: %d", glv);
}

This prints:

Code:
Trying OpenGL version: 4.2
4.2.0 NVIDIA 295.20
OpenGL: GL33

So my graphics card supports 4.2, I also have a 4.2 context, but 3.3 is loaded.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Fri Feb 17, 2012 6:51 pm    Post subject: Reply with quote

Hmmm. Looking at the source for the loader, I see no obvious reason why it would stop at 3.3. Rather than creating a window for every available version, could you try it with just 4.2 in isolation? And explicitly pass the numbers 4 and 2 to the glfwOpenWindowHint calls. My machine only supports up to 3.3, so I have no way to test it myself.

Also, try it without the calls to glfwOpenWindowHInt. When not specifying a version, you should be getting the maximum available context by default.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
dav1d



Joined: 12 Sep 2011
Posts: 40

PostPosted: Sat Feb 18, 2012 8:34 am    Post subject: Reply with quote

Without:
Code:
        glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, v.major);
        glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, v.minor);
glfw creates also a 4.2 context, but Derelict still loads 3.3.

The only thing I can think of is, that in loading 4.0 functions an Exception is risen, so this will skip the 4.X stuff and jump to here: https://github.com/aldacron/Derelict3/blob/master/import/derelict/opengl3/gl3.d#L673. I'll investigate this.
Back to top
View user's profile Send private message
dav1d



Joined: 12 Sep 2011
Posts: 40

PostPosted: Sat Feb 18, 2012 8:43 am    Post subject: Reply with quote

Yeah that was the problem: https://github.com/aldacron/Derelict3/issues/8
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Feb 18, 2012 9:29 am    Post subject: Reply with quote

Hrm. I can see now these silent exceptions aren't going to fly. I suppose I should just throw it, rather than eating it. After all, if the driver reports a specific version as being available, it should be.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group