Changeset 133

Show
Ignore:
Timestamp:
08/26/10 18:56:28 (18 months ago)
Author:
Carsten
Message:

Clean-up of code and comments.

Location:
cafu/branches/cafu_to_wx
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • cafu/branches/cafu_to_wx/Ca3DE/ConDefs.cpp

    r132 r133  
    212212 
    213213 
    214 static int ConFunc_VideoGetModes_Callback(lua_State* LuaState) 
    215 { 
    216     wxDisplay         Display; 
    217     wxArrayVideoModes Modes         =Display.GetModes(); 
    218     const wxVideoMode CurrentMode   =Display.GetCurrentMode(); 
    219     bool              Have32BPPModes=false; 
    220  
    221     for (size_t ModeNr=0; ModeNr<Modes.GetCount(); ModeNr++) 
    222     { 
    223         const wxVideoMode& Mode=Modes[ModeNr]; 
    224  
    225         if (Mode.bpp>=32) 
    226         { 
    227             Have32BPPModes=true; 
    228             break; 
    229         } 
    230     } 
    231  
    232     for (size_t ModeNr=0; ModeNr<Modes.GetCount(); ModeNr++) 
    233     { 
    234         const wxVideoMode& Mode     =Modes[ModeNr]; 
    235         const bool         IsCurrent=(Mode==CurrentMode); 
    236  
    237         if (Have32BPPModes && Mode.bpp<32 && !IsCurrent) continue; 
    238  
    239         Console->Print(cf::va("%3u,    %i x %i, %i BPP @ %i Hz%s\n", ModeNr, Mode.w, Mode.h, Mode.bpp, Mode.refresh, IsCurrent ? " (current)" : "")); 
    240     } 
    241  
     214static int ConFunc_VideoInfo_Callback(lua_State* LuaState) 
     215{ 
     216    Console->Print(GetVideoModes()); 
    242217    Console->Print(cf::va("Renderer Info: %s\n", MatSys::Renderer ? MatSys::Renderer->GetDescription() : "[No renderer active.]")); 
    243218    return 0; 
    244219} 
    245220 
    246 static ConFuncT ConFunc_VideoGetModes("VideoGetModes", ConFunc_VideoGetModes_Callback, ConFuncT::FLAG_MAIN_EXE, "Prints some information about the OpenGL window and renderer."); 
     221static ConFuncT ConFunc_VideoInfo("VideoInfo", ConFunc_VideoInfo_Callback, ConFuncT::FLAG_MAIN_EXE, "Prints some information about the OpenGL window and renderer."); 
    247222 
    248223 
  • cafu/branches/cafu_to_wx/Ca3DE/MainCanvas.cpp

    r132 r133  
    461461    FrameBuffer.PushBackEmpty(Width*Height); 
    462462 
    463     // Read the pixels fromt the OpenGL back buffer into FrameBuffer. 
     463    // Read the pixels from the OpenGL back buffer into FrameBuffer. 
    464464    // Note that the first two parameters (0, 0) specify the left BOTTOM corner of the desired rectangle! 
    465465    glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &FrameBuffer[0]); 
     
    582582 
    583583            ME.Type  =CaMouseEventT::CM_MOVE_X; 
    584             ME.Amount=MouseDelta.x;     // TODO: Factor out screen resolution... 
     584            ME.Amount=MouseDelta.x; 
    585585            if (ME.Amount!=0) ActiveGui->ProcessDeviceEvent(ME); 
    586586 
    587587            ME.Type  =CaMouseEventT::CM_MOVE_Y; 
    588             ME.Amount=MouseDelta.y;     // TODO: Factor out screen resolution... 
     588            ME.Amount=MouseDelta.y; 
    589589            if (ME.Amount!=0) ActiveGui->ProcessDeviceEvent(ME); 
    590590        } 
  • cafu/branches/cafu_to_wx/Libs/OpenGL/OpenGLWindow.cpp

    r100 r133  
    2121================================================================================= 
    2222*/ 
    23  
    24 /********************************/ 
    25 /*** OpenGL Window (DLL Code) ***/ 
    26 /********************************/ 
    2723 
    2824#define DLL_EXPORT_HEADER 
  • cafu/branches/cafu_to_wx/Libs/OpenGL/OpenGLWindow.hpp

    r105 r133  
    2222*/ 
    2323 
    24 /******************************/ 
    25 /*** OpenGL Window (Header) ***/ 
    26 /******************************/ 
    27  
    2824#ifndef _OPENGL_WINDOW_HPP_ 
    2925#define _OPENGL_WINDOW_HPP_ 
     
    3632 
    3733#include <string> 
    38  
    39 // This comment is somewhat outdated... 
    40 // 
    41 // Damn. I already had some finished, fully object-oriented, extremely beautiful OpenGLWindowT and OpenGLWindowInputT 
    42 // classes for all the stuff defined in here. Sadly, it didn't work. Several considerations: 
    43 // 1. There is a lot of old code that relies on the below defined variables 'WindowIsOpen' and 'RenderingContextCounter' 
    44 //    for its OpenGL resource management (e.g. texture objects recovery after a rendering context change). 
    45 //    The otherwise beautiful OO approach of an 'OpenGLWindowT' class does not agree well with such variables. 
    46 //    Rather, every piece of code that needs them had to be changed to receive a pointer to the current 'OpenGLWindowT' object! 
    47 //    This is extremely ugly: The pointer must either be propagated across full function call depth, which will consume 
    48 //    enormous amounts of stack space for its numerous copies alone. The pointer-passing can be reduced at the cost of extremely 
    49 //    ugly, complex, and hard-to-maintain handler code. 
    50 //    Note that these pointers frequently change, at least once for closing and re-opening a window, 
    51 //    and each change must somehow be propagated to the user code. 
    52 //    Also note that a Cafu game DLL needs access to the current OpenGL window, which in turn means that I even 
    53 //    had to bloat the game DLL interface to account for all this gruesome complexity... 
    54 // 2. First idea for improvement: Make everything OO, except one function like 'GetCurrentOpenGLWindow()' 
    55 //    which returns a pointer to the current 'OpenGLWindowT' object. 
    56 //    This function must answer the question which window is currently current (not necessarily the one that has focus), 
    57 //    and therefore probably also requires a 'SetCurrentOpenGLWindow()' complement function. 
    58 // 3. Somebody explained me some interesting things about 'wglCreateContext()' and 'wglMakeCurrent()' a while ago. 
    59 //    Seems like rendering contexts (RCs) may survive their parent windows, and can be bound to future windows. 
    60 //    This approach might solve ALL ABOVE MENTIONED PROBLEMS at once, because their proper use in an 'OpenGLWindowT' 
    61 //    class and the proper use of 'glIsTexture()' (and related functions) in user code might make the need for 
    62 //    'WindowIsOpen' and 'RenderingConextCounter' obsolete. 
    63 //    Sounds very well, but I still consider an immediate change to be risky. Is it portable? What if incompatible 
    64 //    pixel formats are desired between RC changes? Do we *really* get rid of demand for direct access to the 'OpenGLWindowT'? 
    65 //    Best is probably to make a thorough back-up someday, and try it out. 
    66 // 4. Except for 3., I'm still not sure for multi-window programs if and how we can answer the users code question 
    67 //    if and when OpenGL resources are to be (re-)created. How do we manage multiple RCs? Do we have to, after all? 
    6834 
    6935