Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. HELP:: OpenGL code bugs

HELP:: OpenGL code bugs

Scheduled Pinned Locked Moved Graphics
graphicshelpgame-devdata-structuresjson
8 Posts 3 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sagetarian
    wrote on last edited by
    #1

    I got a problem with my opengl wrapper class... Basically, I've been designing an portable API for all my needs. Audio, Graphics, GUI, Resolutions, LANning. etc. But my OpenGL wrapper class is in real need of help. It does everything wonderfully, except the following: when the win32 window is fullscreen and borderless the initial buffer flickers accross the ever changing current rendered screen, and i need help with my font loader, I cant get the draw text procedure work. Help me out, I will give credit where due, thanks. Here's code from my windows class that I think will matter: void register_stapi_classes(); HWND create_window(const c8* class_name, const c8* title, const DWORD extra, const DWORD style, const vector_2d& tl, const vector_2d& br,HWND parent =0); //ctor window::window(const_string _caption, bool _border, bool _resizable, const_vector _tl, const_vector _br) throw(win_error) : mborder(_border), mresizable( (mborder)?_resizable:false), mclosed(false), mcaption(_caption), parent(0), current_cursor(new cursor), icon_file("") { register_stapi_classes(); // register with windows if needed DWORD style = WS_POPUP; // default to no border if(mborder) style |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; // make a border if need be if(mborder && mresizable) style |= WS_MAXIMIZEBOX |WS_THICKFRAME; // make resizable if need be ready = false; wnd = create_window(sapi_main, mcaption.c_str(), 0, style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, _tl, _br); // make the window // the following doesn't work with opengl well, disables almost every opengl capability //SetLayeredWindowAttributes((HWND)wnd, 0, 255, 0);// | LWA_COLORKEY); WS_EX_LAYERED mdimensions = new wdimension(wnd); mcommoncontrol = new wcommoncontrol(wnd); ShowWindow ( (HWND)wnd, false); mcommoncontrol->visible(false); UpdateWindow( (HWND)wnd); // update changes mdimensions->set_dimensions(_tl,_br); // bring to front SetActiveWindow( (HWND)wnd); SetForegroundWindow( (HWND)wnd); win_hash.insert( (HWND)wnd, this); // add to queue of hashed windows run(); mcommoncontrol->visible(true); // display the window } //destructor window::~window() { win_hash.erase( (HWND)wnd); if(IsWindow((HWND)wnd)) DestroyWindow((HWND)wnd); delete mdimensions; delete mcommoncontrol; delete current_cursor; } bool window::run() { if(!mclosed) { MSG messages; HWND

    D 1 Reply Last reply
    0
    • S sagetarian

      I got a problem with my opengl wrapper class... Basically, I've been designing an portable API for all my needs. Audio, Graphics, GUI, Resolutions, LANning. etc. But my OpenGL wrapper class is in real need of help. It does everything wonderfully, except the following: when the win32 window is fullscreen and borderless the initial buffer flickers accross the ever changing current rendered screen, and i need help with my font loader, I cant get the draw text procedure work. Help me out, I will give credit where due, thanks. Here's code from my windows class that I think will matter: void register_stapi_classes(); HWND create_window(const c8* class_name, const c8* title, const DWORD extra, const DWORD style, const vector_2d& tl, const vector_2d& br,HWND parent =0); //ctor window::window(const_string _caption, bool _border, bool _resizable, const_vector _tl, const_vector _br) throw(win_error) : mborder(_border), mresizable( (mborder)?_resizable:false), mclosed(false), mcaption(_caption), parent(0), current_cursor(new cursor), icon_file("") { register_stapi_classes(); // register with windows if needed DWORD style = WS_POPUP; // default to no border if(mborder) style |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; // make a border if need be if(mborder && mresizable) style |= WS_MAXIMIZEBOX |WS_THICKFRAME; // make resizable if need be ready = false; wnd = create_window(sapi_main, mcaption.c_str(), 0, style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, _tl, _br); // make the window // the following doesn't work with opengl well, disables almost every opengl capability //SetLayeredWindowAttributes((HWND)wnd, 0, 255, 0);// | LWA_COLORKEY); WS_EX_LAYERED mdimensions = new wdimension(wnd); mcommoncontrol = new wcommoncontrol(wnd); ShowWindow ( (HWND)wnd, false); mcommoncontrol->visible(false); UpdateWindow( (HWND)wnd); // update changes mdimensions->set_dimensions(_tl,_br); // bring to front SetActiveWindow( (HWND)wnd); SetForegroundWindow( (HWND)wnd); win_hash.insert( (HWND)wnd, this); // add to queue of hashed windows run(); mcommoncontrol->visible(true); // display the window } //destructor window::~window() { win_hash.erase( (HWND)wnd); if(IsWindow((HWND)wnd)) DestroyWindow((HWND)wnd); delete mdimensions; delete mcommoncontrol; delete current_cursor; } bool window::run() { if(!mclosed) { MSG messages; HWND

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You better read the posting guide lines[^] and report your question. There isn't a single person here that's going to read all that code.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        You better read the posting guide lines[^] and report your question. There isn't a single person here that's going to read all that code.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        S Offline
        S Offline
        sagetarian
        wrote on last edited by
        #3

        My bad... Umm... then i'll just restate my dillema in short... My fullscreen OpenGL window flickers... Any ideas why?? hmm... Unless, I try a stripped down win32 window... see if it's not my window attributes... if that don't work, I'll try a stripped down OpenGL wrapper class. If that don't work... help? Well, I try this out, could I ask for any feedback? Oh, Thanks a ton for not coming down on me for that long post... I just cut and pasted, didnt expect it to be as long as that lol:)

        SaGE SaneT

        E 1 Reply Last reply
        0
        • S sagetarian

          My bad... Umm... then i'll just restate my dillema in short... My fullscreen OpenGL window flickers... Any ideas why?? hmm... Unless, I try a stripped down win32 window... see if it's not my window attributes... if that don't work, I'll try a stripped down OpenGL wrapper class. If that don't work... help? Well, I try this out, could I ask for any feedback? Oh, Thanks a ton for not coming down on me for that long post... I just cut and pasted, didnt expect it to be as long as that lol:)

          SaGE SaneT

          E Offline
          E Offline
          El Corazon
          wrote on last edited by
          #4

          sagetarian wrote:

          hmm... Unless, I try a stripped down win32 window... see if it's not my window attributes...

          reducing the problem to the least complex definition allows for rapid testing of new techniques as well as diagnosis of problems related to a specific interface (windows). I am not likely to look through all that code either. You can compare against other implimentations of windowing GL code (Nehe, and others) to see if you did something obviously wrong.

          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

          S 1 Reply Last reply
          0
          • E El Corazon

            sagetarian wrote:

            hmm... Unless, I try a stripped down win32 window... see if it's not my window attributes...

            reducing the problem to the least complex definition allows for rapid testing of new techniques as well as diagnosis of problems related to a specific interface (windows). I am not likely to look through all that code either. You can compare against other implimentations of windowing GL code (Nehe, and others) to see if you did something obviously wrong.

            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

            S Offline
            S Offline
            sagetarian
            wrote on last edited by
            #5

            Thanks for the advice El Corazon, strangely enough I just gave that advice to my IT class, lol... And lo and behold... Windows attributes people... It got so bad wglMakeCurrent(0,0) crashed the program... even in my previously working back-ups Finally i have returned to my window class, and have rebuilt it from scratch... it is looking a lot more tidy if i might add once again, thanks for the feedback. nehe rules everyone, haven't looked at it in ages (lol) but it is a brilliant source to turn to for some heads up and know how of OpenGL code... viva OpenGL... That poses another discussion... do you think OpenGL 3.0 will every see light, with the dawning of DirectX 10's completely new structure... a mag that i read said that it highly unlikely that OpenGL will come close to its opposition... but i rekon, that given the time and effort... anything is possible when it comes to coding our friendly beasts... The PC

            SaGE SaneT

            E 1 Reply Last reply
            0
            • S sagetarian

              Thanks for the advice El Corazon, strangely enough I just gave that advice to my IT class, lol... And lo and behold... Windows attributes people... It got so bad wglMakeCurrent(0,0) crashed the program... even in my previously working back-ups Finally i have returned to my window class, and have rebuilt it from scratch... it is looking a lot more tidy if i might add once again, thanks for the feedback. nehe rules everyone, haven't looked at it in ages (lol) but it is a brilliant source to turn to for some heads up and know how of OpenGL code... viva OpenGL... That poses another discussion... do you think OpenGL 3.0 will every see light, with the dawning of DirectX 10's completely new structure... a mag that i read said that it highly unlikely that OpenGL will come close to its opposition... but i rekon, that given the time and effort... anything is possible when it comes to coding our friendly beasts... The PC

              SaGE SaneT

              E Offline
              E Offline
              El Corazon
              wrote on last edited by
              #6

              sagetarian wrote:

              do you think OpenGL 3.0 will every see light, with the dawning of DirectX 10's completely new structure...

              yes. All things in time.

              sagetarian wrote:

              a mag that i read said that it highly unlikely that OpenGL will come close to its opposition...

              Perhaps, perhaps not. Microsoft has the advantage that it does not answer to a committee, that means changes happen fast. Still OpenGL has broad support in multple platforms, so holds its own. I don't think it is going away. Microsoft has settled it's dispute with the OpenGL committee by ignoring it, but letting other companies support it. That will work as long as it works, no more, no less. But... on the plus side, MS has tried to kill OpenGL now 3 times and failed every time, 4 if you count the failed Fahrenheit project that was to merge DirectX and OpenGL -- that was killed.

              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

              S 1 Reply Last reply
              0
              • E El Corazon

                sagetarian wrote:

                do you think OpenGL 3.0 will every see light, with the dawning of DirectX 10's completely new structure...

                yes. All things in time.

                sagetarian wrote:

                a mag that i read said that it highly unlikely that OpenGL will come close to its opposition...

                Perhaps, perhaps not. Microsoft has the advantage that it does not answer to a committee, that means changes happen fast. Still OpenGL has broad support in multple platforms, so holds its own. I don't think it is going away. Microsoft has settled it's dispute with the OpenGL committee by ignoring it, but letting other companies support it. That will work as long as it works, no more, no less. But... on the plus side, MS has tried to kill OpenGL now 3 times and failed every time, 4 if you count the failed Fahrenheit project that was to merge DirectX and OpenGL -- that was killed.

                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                S Offline
                S Offline
                sagetarian
                wrote on last edited by
                #7

                El Corazon wrote:

                merge DirectX and OpenGL

                haven't tried it... sounds pointless at the moment... but it's cool to know thats possible... especially because DirectX 10 has certain features, like programming on the GPU... then again do we want to merge them... and if we gonna use DirectX at all, why use OpenGL to that effect... unless you want the engine to be semi cross-platformable... in which case, just use DirectX in class that has the same polymorphic ability.... Once again... why merge 'em? strange...

                SaGE SaneT

                E 1 Reply Last reply
                0
                • S sagetarian

                  El Corazon wrote:

                  merge DirectX and OpenGL

                  haven't tried it... sounds pointless at the moment... but it's cool to know thats possible... especially because DirectX 10 has certain features, like programming on the GPU... then again do we want to merge them... and if we gonna use DirectX at all, why use OpenGL to that effect... unless you want the engine to be semi cross-platformable... in which case, just use DirectX in class that has the same polymorphic ability.... Once again... why merge 'em? strange...

                  SaGE SaneT

                  E Offline
                  E Offline
                  El Corazon
                  wrote on last edited by
                  #8

                  sagetarian wrote:

                  Once again... why merge 'em

                  This was a failed attempt to create one non-competing standard for all platform graphics, replacing both DirectX and OpenGL. It failed because of the power struggle within the committee. Sun still holds a grudge against MS and MS still holds a grudge against a few others. The idea was that without the competition they could work on creating a super set of functionality on the scale of a full scenegraph as well as low-level functionality. The project tore itself apart internally and the result was we still have DirectX and OpenGL as competitors for "some" markets. Some meaning that cross platform there still is no choice. In OpenGL 2.0+ you can do some GPU programming. It at least doesn't prevent you, you even have a choice of GPU languages depending on your personal favorites (CUDA, Cg, OSL, etc.). I've been doing GPU programming using vendor extensions since 1.5 was released.

                  _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups