Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Totally Custom Windows...

SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
OK, I need to implement a windowing system in my online game now, but am not sure how to go about this. I can NOT use the Win API because I am in fullscreen OpenGL. Drawing and texturing polygons is easy, and I could make up windows that way, but how would I go about dealing with them? How would I make an edit control? I have to do this or there will be no way to login on the server. This is a whole new ballpark for me, so if you can help, I'd appreciate it.

-[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]

Comments

  • ColdShineColdShine Posts: 597Member
    : OK, I need to implement a windowing system in my online game now, but am not sure how to go about this. I can NOT use the Win API because I am in fullscreen OpenGL.

    WS_EX_TRANSPARENT could be what you're looking for... if it does prevent the window from painting, you can then do your custom painting using OpenGL.


    : Drawing and texturing polygons is easy, and I could make up windows that way,

    Looks weird... what about a 3D-dropping combo box? :P


    : but how would I go about dealing with them? How would I make an edit control?

    Most games have to resort to some kind of custom controls, either by creating clones of the standard controls (which do look similar, but are [b]not[/b] the originals) or by subclassing standard controls (thus keeping their original functionality).

    ________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]

  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    I like the sub-classing idea. How would I go about doing this?

    -[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]

  • chick80chick80 Posts: 349Member
    [b][red]This message was edited by chick80 at 2003-4-24 1:3:12[/red][/b][hr]
    : I like the sub-classing idea. How would I go about doing this?
    :
    It's quite easy! With subclassing you create controls with standard APIs, but you don't use GDI to draw them.
    Let's say you need to draw an edit-box.
    First of all you need an hook, that looks for HCBT_CREATEWND message.
    When it catches that you check for the new-created window class, using GetWindowClass and check if the class name is "EDIT".
    Now you can use GetWindowLong with GWL_WNDPROC parameter to get the WndProc for the edit control, you'll store it in some variable (you'll need it later) and you use SetWindowLong to set the WndProc to your custom WndProc.
    In your WndProc you'll manage all the stuff you need, like WM_PAINT or WM_NCPAINT messages or anything you like, and call the old WndProc for the rest of the messages you don't need to process.

    And that's all!

    Ah, you can also use global subclassing, using GetClassLong/SetClassLong, instead of the window equivalent. I have never used it, but I think that with these you can avoid the hook, as you set them once, at the beginning of the program.

    Hope this helps
    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS




  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    I'll check into it. While I've stopped playing with the windowing system, I have managed to create soem awesome effects in GL that I plan on using in-game. I even had shadows for a while (using a stencil buffer), but didn't like them so I plan on writing my own later.

    -[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]

  • chick80chick80 Posts: 349Member
    : I'll check into it. While I've stopped playing with the windowing system, I have managed to create soem awesome effects in GL that I plan on using in-game. I even had shadows for a while (using a stencil buffer), but didn't like them so I plan on writing my own later.
    :
    If you want very good shadow try using Volume Shadows.
    I don't have a clue on how to implement them in OpenGL, but in DX using vertex shaders it's quite simple, although you need three render passes (two in the stencil buffer and one to the back buffer) so it can be quite heavy to process...

    bye
    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    I've looked into vertex-shading. Morrowind uses it for the awesome water effect of reflections, shimmer, and transparency all in one. However, form what I have read, GL only does one pass with them. I think I read somewhere about a second pass which can be used, but not three. I'll read up on the redbook and see what I can find.

    -[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]

Sign In or Register to comment.