Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

glEnable() causes weeeeird program close stuff

iDaZeiDaZe Member Posts: 464
Ok, now this is weird.
If I make a call to "glEnable(GL_TEXTURES_2D)" in my program, it doesn't completly exit when I close it. It exits the program (passed all breakpoints I set at the end), but then gets stuck in a WaitForMultipleObject loop (seen in the debugger). Anybody else ever hear of something like that ? And if I don't call "glEnable(GL_TEXTURES_2D)", the program quits just fine.

Comments

  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    : Ok, now this is weird.
    : If I make a call to "glEnable(GL_TEXTURES_2D)" in my program, it doesn't completly exit when I close it. It exits the program (passed all breakpoints I set at the end), but then gets stuck in a WaitForMultipleObject loop (seen in the debugger). Anybody else ever hear of something like that ? And if I don't call "glEnable(GL_TEXTURES_2D)", the program quits just fine.
    :
    OpenGL can't just "exit" like a normal Windoze app. You need a function to make nothing the current window, then you need to release your dc and rc, and there's several more things that you must do before returning msg.wParam. If you do not, your program MAY exit, but it'll eat resources. Here's an example:
    [code]
    int WINAPI WinMain(blah)
    {
    ...do stuff...

    KillGLWindow();
    return msg.wParam;
    }
    [/code]
    This assumes that your OpenGL shutdown function is called "KillGLWindow". I suggest using the one used in Nehe's tutorials. It's all ANSI C++ and very easy to follow. Then as you add to your app, you can add or change the function to suit your needs.
    http://nehe.gamedev.net/

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • iDaZeiDaZe Member Posts: 464
    : : Ok, now this is weird.
    : : If I make a call to "glEnable(GL_TEXTURES_2D)" in my program, it doesn't completly exit when I close it. It exits the program (passed all breakpoints I set at the end), but then gets stuck in a WaitForMultipleObject loop (seen in the debugger). Anybody else ever hear of something like that ? And if I don't call "glEnable(GL_TEXTURES_2D)", the program quits just fine.
    : :
    : OpenGL can't just "exit" like a normal Windoze app. You need a function to make nothing the current window, then you need to release your dc and rc, and there's several more things that you must do before returning msg.wParam. If you do not, your program MAY exit, but it'll eat resources. Here's an example:
    : [code]
    : int WINAPI WinMain(blah)
    : {
    : ...do stuff...
    :
    : KillGLWindow();
    : return msg.wParam;
    : }
    : [/code]
    : This assumes that your OpenGL shutdown function is called "KillGLWindow". I suggest using the one used in Nehe's tutorials. It's all ANSI C++ and very easy to follow. Then as you add to your app, you can add or change the function to suit your needs.
    : http://nehe.gamedev.net/
    :
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
    :
    :

    that's just the wierd thing, I am shutting everything down correctly. Except for the return msg.wParam because I'm using Delphi and Delphi has it's own entry point. But I'v never had this problem before, I'v tried adding glDisable(GL_TEXTURES_2D) at the end and stuff, but nothing ...
    btw, does OpenGL handle textures in a sepperate thread or process or something ?
  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    OpenGL shouldn't be on a seperate thread, but as far as Delphi and Pascal go, I can't tell you much. I taught myself Basic, QB, C/C++, ASM, and at one time, PowerBasic, but I tried Delphi and Pascal and the idiot who wrote them made them 150% different from anythign I'd seen before, and I got nowhere. The ease of learning the other languages was the extreme similarities int he fucntions, but Pascal just threw me, lol. You may want to find out if there is some alternate includes/headers for OpenGL in Pascal and Delphi. It may be something as simple as that.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • iDaZeiDaZe Member Posts: 464
    Damn, still doesn't work ... a screw it, who needs texture's anyway right ;-) (My laptop certainly doesn't, seeing as texturing drags the framerate from 90-100 fps to 5-10 :-))
  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    : Damn, still doesn't work ... a screw it, who needs texture's anyway right ;-) (My laptop certainly doesn't, seeing as texturing drags the framerate from 90-100 fps to 5-10 :-))
    :
    Ah, maybe your laptop video adapter isn't fully OpenGL compliant? Try out your app on a tower/desktop and see if it works. If it does, you're set!

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _______ [ http://forcoder.org ] free ebooks and video tutorials about / Swift PHP Python Visual Basic .NET MATLAB R Objective-C Java Assembly Delphi Visual Basic Go JavaScript Ruby Perl C++ C# Scratch C PL/SQL Bash Alice Julia D Hack Dart Apex F# Scala ABAP LabVIEW COBOL Scheme Fortran Prolog Lisp FoxPro VBScript Ada Logo Clojure Erlang Crystal Lua Transact-SQL SAS Kotlin Rust Awk ML / _____________

Sign In or Register to comment.