February 26, 2015

I'd also try hacking in Window.d directly to see if even basic gl commands work, e.g. immediately after window and context creation, try rendering a triangle then tweak the context initialisation to see if it affects anything.

It may help you track down exactly which part of the GL setup is causing problems.

Cheers,
Stew
February 26, 2015
On Thursday, 26 February 2015 at 02:32:51 UTC, stewarth wrote:
>
>
> I'd also try hacking in Window.d directly to see if even basic gl commands work, e.g. immediately after window and context creation, try rendering a triangle then tweak the context initialisation to see if it affects anything.
>
> It may help you track down exactly which part of the GL setup is causing problems.
>
> Cheers,
> Stew

I know almost nothing about OpenGL but using your method(sorta):
void reportGLErrors() {
	GLenum errCode;
	const GLubyte *errString;
	if ((errCode = glGetError()) != GL_NO_ERROR)
	{
		writeln("OPEN GL ERROR: ", errCode);
	}
}

I get error code 1282 repeatedly.

From a google search someone says:
"First, glGetError() will return 1282 - invalid operation if the GL context is not current (or not yet created). So, create your context first, then call glGetError. And, verify that any parent class or member class does not call GL functions in their constructors or prior to context being created."

Can someone with more OpenGL knowledge clarify what this means?
February 26, 2015
On 26/02/2015 3:57 p.m., Gan wrote:
> On Thursday, 26 February 2015 at 02:32:51 UTC, stewarth wrote:
>>
>>
>> I'd also try hacking in Window.d directly to see if even basic gl
>> commands work, e.g. immediately after window and context creation, try
>> rendering a triangle then tweak the context initialisation to see if
>> it affects anything.
>>
>> It may help you track down exactly which part of the GL setup is
>> causing problems.
>>
>> Cheers,
>> Stew
>
> I know almost nothing about OpenGL but using your method(sorta):
> void reportGLErrors() {
>      GLenum errCode;
>      const GLubyte *errString;
>      if ((errCode = glGetError()) != GL_NO_ERROR)
>      {
>          writeln("OPEN GL ERROR: ", errCode);
>      }
> }
>
> I get error code 1282 repeatedly.
>
>  From a google search someone says:
> "First, glGetError() will return 1282 - invalid operation if the GL
> context is not current (or not yet created). So, create your context
> first, then call glGetError. And, verify that any parent class or member
> class does not call GL functions in their constructors or prior to
> context being created."
>
> Can someone with more OpenGL knowledge clarify what this means?

1. Program starts
2. Window gets created
3. Context gets created
4. Context is activated
5. Profit???

Basically before the context is created and activated you cannot call any OpenGL functions. If you do, they will error out.

The bit about constructors ext. don't worry about it. Its just about e.g. where the calls to OpenGL can exist.
February 26, 2015
On Thursday, 26 February 2015 at 03:01:42 UTC, Rikki Cattermole wrote:
> On 26/02/2015 3:57 p.m., Gan wrote:
>> On Thursday, 26 February 2015 at 02:32:51 UTC, stewarth wrote:
>>>
>>>
>>> I'd also try hacking in Window.d directly to see if even basic gl
>>> commands work, e.g. immediately after window and context creation, try
>>> rendering a triangle then tweak the context initialisation to see if
>>> it affects anything.
>>>
>>> It may help you track down exactly which part of the GL setup is
>>> causing problems.
>>>
>>> Cheers,
>>> Stew
>>
>> I know almost nothing about OpenGL but using your method(sorta):
>> void reportGLErrors() {
>>     GLenum errCode;
>>     const GLubyte *errString;
>>     if ((errCode = glGetError()) != GL_NO_ERROR)
>>     {
>>         writeln("OPEN GL ERROR: ", errCode);
>>     }
>> }
>>
>> I get error code 1282 repeatedly.
>>
>> From a google search someone says:
>> "First, glGetError() will return 1282 - invalid operation if the GL
>> context is not current (or not yet created). So, create your context
>> first, then call glGetError. And, verify that any parent class or member
>> class does not call GL functions in their constructors or prior to
>> context being created."
>>
>> Can someone with more OpenGL knowledge clarify what this means?
>
> 1. Program starts
> 2. Window gets created
> 3. Context gets created
> 4. Context is activated
> 5. Profit???
>
> Basically before the context is created and activated you cannot call any OpenGL functions. If you do, they will error out.
>
> The bit about constructors ext. don't worry about it. Its just about e.g. where the calls to OpenGL can exist.

Yes, my bad sorry, but whatever works. The point is dive in and start printfing about in Window.d, checking error codes to try and figure out where things become stuffed up.


Cheers,
Stew
February 26, 2015
On Thursday, 26 February 2015 at 03:17:32 UTC, stewarth wrote:
> On Thursday, 26 February 2015 at 03:01:42 UTC, Rikki Cattermole wrote:
>> On 26/02/2015 3:57 p.m., Gan wrote:
>>> On Thursday, 26 February 2015 at 02:32:51 UTC, stewarth wrote:
>>>>
>>>>
>>>> I'd also try hacking in Window.d directly to see if even basic gl
>>>> commands work, e.g. immediately after window and context creation, try
>>>> rendering a triangle then tweak the context initialisation to see if
>>>> it affects anything.
>>>>
>>>> It may help you track down exactly which part of the GL setup is
>>>> causing problems.
>>>>
>>>> Cheers,
>>>> Stew
>>>
>>> I know almost nothing about OpenGL but using your method(sorta):
>>> void reportGLErrors() {
>>>    GLenum errCode;
>>>    const GLubyte *errString;
>>>    if ((errCode = glGetError()) != GL_NO_ERROR)
>>>    {
>>>        writeln("OPEN GL ERROR: ", errCode);
>>>    }
>>> }
>>>
>>> I get error code 1282 repeatedly.
>>>
>>> From a google search someone says:
>>> "First, glGetError() will return 1282 - invalid operation if the GL
>>> context is not current (or not yet created). So, create your context
>>> first, then call glGetError. And, verify that any parent class or member
>>> class does not call GL functions in their constructors or prior to
>>> context being created."
>>>
>>> Can someone with more OpenGL knowledge clarify what this means?
>>
>> 1. Program starts
>> 2. Window gets created
>> 3. Context gets created
>> 4. Context is activated
>> 5. Profit???
>>
>> Basically before the context is created and activated you cannot call any OpenGL functions. If you do, they will error out.
>>
>> The bit about constructors ext. don't worry about it. Its just about e.g. where the calls to OpenGL can exist.
>
> Yes, my bad sorry, but whatever works. The point is dive in and start printfing about in Window.d, checking error codes to try and figure out where things become stuffed up.
>
>
> Cheers,
> Stew

I did what you suggested. I added a bunch of writeln and reportGLErrors. These are the results:
glMatrixMode(GL_PROJECTION);
OPEN GL ERROR: 1282



glLoadIdentity();
OPEN GL ERROR: 1282



glShadeModel(GL_FLAT);
OPEN GL ERROR: 1282


glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
OPEN GL ERROR: 1280


glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
OPEN GL ERROR: 1280


glOrtho(0, vMode.width, vMode.height, 0, 1, -1);
OPEN GL ERROR: 1282


Each error happens after each line is called. I'm not sure why this happens or what it means.
February 26, 2015
On Thursday, 26 February 2015 at 06:32:07 UTC, Gan wrote:
> On Thursday, 26 February 2015 at 03:17:32 UTC, stewarth wrote:
>> On Thursday, 26 February 2015 at 03:01:42 UTC, Rikki Cattermole wrote:
>>> On 26/02/2015 3:57 p.m., Gan wrote:
>>>> On Thursday, 26 February 2015 at 02:32:51 UTC, stewarth wrote:
>>>>>
>>>>>
>>>>> I'd also try hacking in Window.d directly to see if even basic gl
>>>>> commands work, e.g. immediately after window and context creation, try
>>>>> rendering a triangle then tweak the context initialisation to see if
>>>>> it affects anything.
>>>>>
>>>>> It may help you track down exactly which part of the GL setup is
>>>>> causing problems.
>>>>>
>>>>> Cheers,
>>>>> Stew
>>>>
>>>> I know almost nothing about OpenGL but using your method(sorta):
>>>> void reportGLErrors() {
>>>>   GLenum errCode;
>>>>   const GLubyte *errString;
>>>>   if ((errCode = glGetError()) != GL_NO_ERROR)
>>>>   {
>>>>       writeln("OPEN GL ERROR: ", errCode);
>>>>   }
>>>> }
>>>>
>>>> I get error code 1282 repeatedly.
>>>>
>>>> From a google search someone says:
>>>> "First, glGetError() will return 1282 - invalid operation if the GL
>>>> context is not current (or not yet created). So, create your context
>>>> first, then call glGetError. And, verify that any parent class or member
>>>> class does not call GL functions in their constructors or prior to
>>>> context being created."
>>>>
>>>> Can someone with more OpenGL knowledge clarify what this means?
>>>
>>> 1. Program starts
>>> 2. Window gets created
>>> 3. Context gets created
>>> 4. Context is activated
>>> 5. Profit???
>>>
>>> Basically before the context is created and activated you cannot call any OpenGL functions. If you do, they will error out.
>>>
>>> The bit about constructors ext. don't worry about it. Its just about e.g. where the calls to OpenGL can exist.
>>
>> Yes, my bad sorry, but whatever works. The point is dive in and start printfing about in Window.d, checking error codes to try and figure out where things become stuffed up.
>>
>>
>> Cheers,
>> Stew
>
> I did what you suggested. I added a bunch of writeln and reportGLErrors. These are the results:
> glMatrixMode(GL_PROJECTION);
> OPEN GL ERROR: 1282
>
>
>
> glLoadIdentity();
> OPEN GL ERROR: 1282
>
>
>
> glShadeModel(GL_FLAT);
> OPEN GL ERROR: 1282
>
>
> glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
> OPEN GL ERROR: 1280
>
>
> glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
> OPEN GL ERROR: 1280
>
>
> glOrtho(0, vMode.width, vMode.height, 0, 1, -1);
> OPEN GL ERROR: 1282
>
>
> Each error happens after each line is called. I'm not sure why this happens or what it means.

According to docs: 1280 is GL_INVALID_ENUM
February 26, 2015
On Thursday, 26 February 2015 at 06:33:26 UTC, Gan wrote:
> On Thursday, 26 February 2015 at 06:32:07 UTC, Gan wrote:
>> On Thursday, 26 February 2015 at 03:17:32 UTC, stewarth wrote:
>>> On Thursday, 26 February 2015 at 03:01:42 UTC, Rikki Cattermole wrote:
>>>> On 26/02/2015 3:57 p.m., Gan wrote:
>>>>> On Thursday, 26 February 2015 at 02:32:51 UTC, stewarth wrote:
>>>>>>
>>>>>>
>>>>>> I'd also try hacking in Window.d directly to see if even basic gl
>>>>>> commands work, e.g. immediately after window and context creation, try
>>>>>> rendering a triangle then tweak the context initialisation to see if
>>>>>> it affects anything.
>>>>>>
>>>>>> It may help you track down exactly which part of the GL setup is
>>>>>> causing problems.
>>>>>>
>>>>>> Cheers,
>>>>>> Stew
>>>>>
>>>>> I know almost nothing about OpenGL but using your method(sorta):
>>>>> void reportGLErrors() {
>>>>>  GLenum errCode;
>>>>>  const GLubyte *errString;
>>>>>  if ((errCode = glGetError()) != GL_NO_ERROR)
>>>>>  {
>>>>>      writeln("OPEN GL ERROR: ", errCode);
>>>>>  }
>>>>> }
>>>>>
>>>>> I get error code 1282 repeatedly.
>>>>>
>>>>> From a google search someone says:
>>>>> "First, glGetError() will return 1282 - invalid operation if the GL
>>>>> context is not current (or not yet created). So, create your context
>>>>> first, then call glGetError. And, verify that any parent class or member
>>>>> class does not call GL functions in their constructors or prior to
>>>>> context being created."
>>>>>
>>>>> Can someone with more OpenGL knowledge clarify what this means?
>>>>
>>>> 1. Program starts
>>>> 2. Window gets created
>>>> 3. Context gets created
>>>> 4. Context is activated
>>>> 5. Profit???
>>>>
>>>> Basically before the context is created and activated you cannot call any OpenGL functions. If you do, they will error out.
>>>>
>>>> The bit about constructors ext. don't worry about it. Its just about e.g. where the calls to OpenGL can exist.
>>>
>>> Yes, my bad sorry, but whatever works. The point is dive in and start printfing about in Window.d, checking error codes to try and figure out where things become stuffed up.
>>>
>>>
>>> Cheers,
>>> Stew
>>
>> I did what you suggested. I added a bunch of writeln and reportGLErrors. These are the results:
>> glMatrixMode(GL_PROJECTION);
>> OPEN GL ERROR: 1282
>>
>>
>>
>> glLoadIdentity();
>> OPEN GL ERROR: 1282
>>
>>
>>
>> glShadeModel(GL_FLAT);
>> OPEN GL ERROR: 1282
>>
>>
>> glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
>> OPEN GL ERROR: 1280
>>
>>
>> glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
>> OPEN GL ERROR: 1280
>>
>>
>> glOrtho(0, vMode.width, vMode.height, 0, 1, -1);
>> OPEN GL ERROR: 1282
>>
>>
>> Each error happens after each line is called. I'm not sure why this happens or what it means.
>
> According to docs: 1280 is GL_INVALID_ENUM

Figured it out. DGame wants OpenGL 3.0+ context. However it uses some functions in OpenGL 2.1 that have been depreciated. The mac OpenGL doesn't allow depreciated functions.

DGame's OpenGL code is too outdated to run on a 3.0+ GL context on mac.

Required fix: Either lower the context to 2.1 or upgrade the code to not use depreciated functions.
February 26, 2015
> Figured it out. DGame wants OpenGL 3.0+ context. However it uses some functions in OpenGL 2.1 that have been depreciated. The mac OpenGL doesn't allow depreciated functions.
>
> DGame's OpenGL code is too outdated to run on a 3.0+ GL context on mac.
>
> Required fix: Either lower the context to 2.1 or upgrade the code to not use depreciated functions.

Ah, indeed. I use some outdated constants and opengl functions. But I believe I'm using also functions which need OpenGL 3.0. Could you try to reduce the OpenGL Version to 2.1 and test it again?
February 26, 2015
On Thursday, 26 February 2015 at 08:19:30 UTC, Namespace wrote:
>> Figured it out. DGame wants OpenGL 3.0+ context. However it uses some functions in OpenGL 2.1 that have been depreciated. The mac OpenGL doesn't allow depreciated functions.
>>
>> DGame's OpenGL code is too outdated to run on a 3.0+ GL context on mac.
>>
>> Required fix: Either lower the context to 2.1 or upgrade the code to not use depreciated functions.
>
> Ah, indeed. I use some outdated constants and opengl functions. But I believe I'm using also functions which need OpenGL 3.0. Could you try to reduce the OpenGL Version to 2.1 and test it again?

Wouldaya look at that, it works. http://cl.ly/image/0Z000U0m1i3U

I wonder what features are broken.
February 26, 2015
On Thursday, 26 February 2015 at 08:35:12 UTC, Gan wrote:
> On Thursday, 26 February 2015 at 08:19:30 UTC, Namespace wrote:
>>> Figured it out. DGame wants OpenGL 3.0+ context. However it uses some functions in OpenGL 2.1 that have been depreciated. The mac OpenGL doesn't allow depreciated functions.
>>>
>>> DGame's OpenGL code is too outdated to run on a 3.0+ GL context on mac.
>>>
>>> Required fix: Either lower the context to 2.1 or upgrade the code to not use depreciated functions.
>>
>> Ah, indeed. I use some outdated constants and opengl functions. But I believe I'm using also functions which need OpenGL 3.0. Could you try to reduce the OpenGL Version to 2.1 and test it again?
>
> Wouldaya look at that, it works. http://cl.ly/image/0Z000U0m1i3U
>
> I wonder what features are broken.

It would be very kind of you, if you figure it out. Try everything you can, all tutorials. If nothing is broken, I will supply a fix for OSX where I put the OpenGL version to 2.1.