Dgame revived

Gan via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Feb 25 22:32:03 PST 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.


More information about the Digitalmars-d-announce mailing list