Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::ContextSettings, opengl version hint  (Read 16422 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #15 on: January 31, 2011, 08:13:08 pm »
Quote
I think the exisiting internal rendering context only apply if you create on the main thread. When I create my window on the main thread, it didn't have any problems. The problem only appear when I change all the window creation to run from a separate thread.

Yes. In other threads you need to have a dummy context before you can execute OpenGL stuff. However, I agree that creating a window shouldn't require this. This is going to be fixed soon in SFML 2 anyway.

Quote
I also modified the code for selecting the version context to create, because although my card supports 3.3 if I chose 4.0, it would fail and jump to 2.0 instead

Really? This is supposed to be fixed. What did you do?

Quote
Just wondering, Laurent, is it safe to comment out this line

I don't know, this line changed so many times. I activated it back a few months ago, for a good reason, but I don't remember why.
But like I said, everything will soon be fixed in SFML 2 ;)
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #16 on: February 01, 2011, 09:58:10 am »
Quote

Quote

I also modified the code for selecting the version context to create, because although my card supports 3.3 if I chose 4.0, it would fail and jump to 2.0 instead

Really? This is supposed to be fixed. What did you do?


I created a const array (doesn't matter if it is global or not) to check the version something along the line of
Code: [Select]

//the elements in the array represent the maximum minor version
//for e.g index [1] have 5 because the max opengl for 1.x is 1.5
//the element stored in the 0th index is the highest opengl major version
//in this case it is 4
const unsigned int minor_ver[] = {4, 5, 1, 3, 1};

//set the version to the highest valid one before looping in case user request for invalid versions
//e.g if user request version 13.8 we drop to the highest valid ones.

mySettings.MajorVersion = (mySettings.MajorVersion > minor_ver[0]) ? minor_ver[0] : mySettings.MajorVersion;

mySettings.MinorVersion = (mySettings.MinorVersion > minor_ver[mySettings.MajorVersion]) ? minor_ver[mySettings.MajorVersion] : mySettings.MinorVersion;

while (!myContext && mySettings.MajorVersion >= 3)
{
     //...... creating of the context etc .....

     if (!myContext)
     {
         mySettings.MinorVersion = (mySettings.MinorVersion > 0) ?
              mySettings.MinorVersion - 1 : minor_ver[--mySettings.MajorVersion];
     }
}



not sure if this is the best way to go about doing it

edited: change "Settings" to "mySettings" and change typo errors

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #17 on: February 01, 2011, 10:21:49 am »
Oh, I just realized that the current code assumes that 3 is the maximum major version.

Doesn't changing this line in the original code
Code: [Select]
mySettings.MajorVersion = 2;
...to this
Code: [Select]
mySettings.MajorVersion--;
...solve the problem?
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #18 on: February 01, 2011, 10:29:33 am »
it would work too, but it would loop redundant times. For e.g if the user put 10.10, it would loop 60 times before hitting a valid profile. Or if the user request for major version 3, minor version 888, it would end up looping 885 times before hitting the 3.3 profile.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #19 on: February 01, 2011, 10:43:14 am »
Yep, but I don't think this is a problem. And this way I don't have to update the code every time a new minor version of OpenGL is released.
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #20 on: February 01, 2011, 11:29:46 am »
okie :)

btw when you say the context creation on multiple thread will be fixed in sfml2, does it refer to the official release of sfml2, or the current snapshot is fixed already??

:D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #21 on: February 01, 2011, 11:38:51 am »
It will be fixed soon (before the official release) but it's not done yet, I'm working on it.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #22 on: February 04, 2011, 11:23:25 pm »
I fixed the context creation thing but I can't test it, can you confirm that it's working?
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #23 on: February 05, 2011, 10:50:14 am »
Hi, Laurent, I can't seems to download the latest snapshot from the website.

http://www.sfml-dev.org/download.php

The links doesn't seems to work. Is there a way to get the latest source files??

regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #24 on: February 05, 2011, 12:59:54 pm »
Have you tried with a SVN client directly? Maybe it's just the HTTP access that is down.
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #25 on: February 06, 2011, 08:01:08 am »
hi, both method didn't work for me. When I tried to access it using the http link to get the snap shot it gives the error

Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

when using tortoise SVN, it says the remote host forcibly close the connection.

regards

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
sf::ContextSettings, opengl version hint
« Reply #26 on: February 06, 2011, 10:11:50 am »
From https://sourceforge.net/blog/update-sourceforgenet-attack/
Quote
Non CVS SCM data
We are still working on validating SVN, Hg, Bzr, and Git data on the main sourceforge.net SCM servers. These servers weren’t compromised, but the SCM data was accessible to the attacker. At this time we don’t have any evidence of tampering with SCM data. We will publish the full results of our validation work when the work is complete.

We have also redesigned the platform for these services, and will be pushing out updated configurations and improved security controls. We expect the updates to this service and the results of this validation work to ship later this week. ViewVC (web-based SCM access) will be brought online as we ship the updated SCM servers.


So I think we have to wait a little bit more.

But : for me the svn command line client works just fine.
SFML / OS X developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #27 on: February 08, 2011, 05:07:51 pm »
hi, SVN is up and working again. :) I tried the new snap shot. The context is sort of working however I can create a 3.3 and 3.2 context but when creating a 3.0 or 3.1 context, it would fail. However if I am to remove the attribute pair:

WGL_CONTEXT_PROFILE_MASK_ARB
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB

it would work.

The creation of context from a separate thread still doesn't seems to work :(

P.S: I am not sure if this is intended, but if the creation of a 3.0 context fail, the return value from ContextSettings shows that the context was created with a 2.9 version. Maybe it would be better to report a 2.1 version or 2.0 version :)

regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::ContextSettings, opengl version hint
« Reply #28 on: February 08, 2011, 06:10:52 pm »
Quote
However if I am to remove the attribute pair:

WGL_CONTEXT_PROFILE_MASK_ARB
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB

it would work.

Indeed, this stuff seems to be new to OpenGL 3.2. But it seems that the 1.x were deprecated in 3.0. So what happens in 3.0 and 3.1?

Quote
P.S: I am not sure if this is intended, but if the creation of a 3.0 context fail, the return value from ContextSettings shows that the context was created with a 2.9 version. Maybe it would be better to report a 2.1 version or 2.0 version

Ah, this is true :)
Laurent Gomila - SFML developer

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
sf::ContextSettings, opengl version hint
« Reply #29 on: February 08, 2011, 08:27:24 pm »
Quote from: "Laurent"
Quote
However if I am to remove the attribute pair:

WGL_CONTEXT_PROFILE_MASK_ARB
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB

it would work.

Indeed, this stuff seems to be new to OpenGL 3.2. But it seems that the 1.x were deprecated in 3.0. So what happens in 3.0 and 3.1?

Quote
P.S: I am not sure if this is intended, but if the creation of a 3.0 context fail, the return value from ContextSettings shows that the context was created with a 2.9 version. Maybe it would be better to report a 2.1 version or 2.0 version

Ah, this is true :)


3.0 deprecated features, but did not remove any. 3.1/3.2 actually removes them (and deprecates other features). In 3.2 the concept of different profiles was introduced, to allow using removed features when specifying a compatiblity profile.

So, if you specify 3.0, there is no need to use a compatibility profile because all parts of the 1.x standard are still part of the standard (just deprecated, not removed!)