home · browse · search · game entities · user directory · message board · IRC | register

October 28, 2006, 4:54 pm PDT
username  
password  
forgot password?

Popular Resources
  • Half-Life 2 Mod FAQ
  • Valve Hammer Editor
  • Hammer 3.5 beta test
  • Half-Life Utilities
  • game data files
  • ZHLT 2.5.3 custom build
  • Half-Life SDK
  • Feedback
    If you've got any feedback, suggestions, or bugs to report regarding the Collective website, go here!

  • Feedback (301)
  • Newsletter
     
    Enter your email address in the above form to add yourself to the email newsletter list. Click here for more info.

    Hosted Sites
  • Valve ERC
  • Collective
  • TFMapped
  • Spirit of Half-Life
  • Selective Design
  • Pixel Reviews
  • recent articles

    NPC and Item Placement Theory
    17/03/05 11:35pm PST
    Non-Player Character (NPC) and item placement can influence both the gameflow and immersion of a level. This article aims to give some pointers on how to properly place them.
    - Hugh 'Hugh' Lloyd

    Got Props?
    13/03/05 08:32am PST
    A common problem in HL2 mapping is props not showing up in game. This article explains why and offers solutions.
    - Jeff 'Yesukai' Pritchard

    Simulating Randomness
    18/12/04 11:29pm PST
    This article focuses on how to properly simulate random events that should occur at a certain average frequency, or within a certain probability per period of time.
    - Skyler 'Zipster' York

    Adding Single-Player Weapons to Half-Life 2
    15/12/04 06:52pm PST
    Covers the process behind adding weapons to a single-player Half-Life 2 modification.
    - Skyler 'Zipster' York

    Your world in HL2
    06/12/04 12:17am PST
    This article gives tips and advice to anyone wanting to make custom photorealistic textures to be used in Half-Life 2.
    - Oksid

    Hiding in Shadow
    21/08/04 01:11pm PDT
    Describes how to create a function that has monsters disregard you if you are hiding in a certain level of "darkness," which can be set from within map properties.
    - Anders [Wolf] Jenbo (NoBody)

    XSI EXP for Half-Life 2 Tutorial - Camera Control
    23/09/04 12:43am PDT
    A SOFTIMAGE|XSI tutorial explaining all of the camera controls available to you in XSI!
    - Josh Enes

    Bump Mapping in Half-Life
    08/08/04 11:58am PDT
    Details a method of achieving real-time bump mapping in Half-Life, and provides an implementation of the algorithm.
    - Francis 'DeathWish' Woodhouse

    Real-Time "TRON 2.0" Glow For Low-Spec Hardware
    19/06/04 02:06pm PDT
    A sequel to the original "Real-Time 'TRON 2.0' Glow" article, this describes how to implement real-time glow that works on low-spec graphics cards.
    - Francis 'DeathWish' Woodhouse

    Hitboxes and Code
    05/06/04 06:25pm PDT
    How do I make only one part of a monster take damage? Learn about the relationship between model hitboxes and what you can do with them in a characters code.
    - Jonathan 'Teh_Freak' Smith

    Painlessly Drawing TriAPI In Orthogonal Mode
    [Sat Mar 08, 2003 / 02:05am PST] Tony 'omega' Sergi - comments (12) comments enabled

    Orthogonal Triangle Renderering inside The Half-Life SDK

    I decided to whip up this tutorial to show you the simplicity of drawing triangles in orthogonal mode using TriAPI. This is really simple, and I'm even doing all the work for you! An example regarding how to draw a quad over the entire screen is included at the end of the article.

    Step #1: Load up tri.cpp and add this shell at the very bottom:

    /*
    =================
    HUD_DrawOrthoTriangles
    Orthogonal Triangles -- (relative to resolution,
    smackdab on the screen) add them here
    =================
    */

    void HUD_DrawOrthoTriangles( void )
    {
    }



    Step #2: Open up HUD_Redraw.cpp
    Prototype the function above redraw():


    void HUD_DrawOrthoTriangles( void );
    int CHud :: Redraw( float flTime, int intermission )
    {



    Step #3: Add the function inside redraw, so it's called:

    HUD_DrawOrthoTriangles is called from the HUD draw functions, because at this point the engine is already in orthogonal mode. Hence, the Z coord is a "magic 0", because it's not rendering in world space in ortho, it's 2D.

                   ...
                   pList = pList->pNext;
              }
         }

         //omega;draw orthogonal triangles
         HUD_DrawOrthoTriangles();

         // are we in demo mode? do we need to
         // draw the logo in the top corner?

         if (m_iLogo)
         ...



    Step #4: Make use of it!

    Example:

    #define ORTHOEXAMPLE
    #ifdef ORTHOEXAMPLE

    void OrthoExample()
    {
         gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive

         // use hotglow, or any other sprite for the texture
         gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)
              gEngfuncs.GetSpritePointer(SPR_Load("sprites/hotglow.spr")),
              0);

         gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
         gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad

         //remember, always list vertices in counter-clockwise
         // order, unless you want the quad to be backwards =)
         // the third value of vertex3f will always be 0 in ortho mode,
         // don't change it unless you wan't funny things to happen.


         //top left
         gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);
         gEngfuncs.pTriAPI->Vertex3f(0, 0, 0);

         //bottom left
         gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);
         gEngfuncs.pTriAPI->Vertex3f(0, ScreenHeight, 0);

         //bottom right
         gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);
         gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, ScreenHeight, 0);

         //top right
         gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);
         gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, 0, 0);

         gEngfuncs.pTriAPI->End(); //end our list of vertexes
         gEngfuncs.pTriAPI->RenderMode(kRenderNormal); //return to normal
    }
    #endif
    void HUD_DrawOrthoTriangles( void )
    {
    #ifdef ORTHOEXAMPLE
         OrthoExample();
    #endif
    }


    That about does it for this "tutorial". You now have the framework to draw triangles onto the hud with ease using TriAPI. Have fun, and enjoy! If you have any questions, email me at omega@thewavelength.net.

    -omega
    article created on Fri Mar 07, 2003 / 12:32pm PST
    this item has been viewed 4055 times
    [Half-Life / coding]

    Only registered users can post comments. Have you registered yet?

    user comments

    displaying comments of normal or higher rating

    1.

    Tony 'omega' Sergi
    Mon Mar 10, 2003 / 09:37am PST

      I just wanted to add a little note that ortho unfortunately doesn't work in software mode. I don't know how many would really mind lack of software support in their mod though, its so slow =)

    (i didn't feel like making a new comment, and decided to edit instead)
    Another thing to note; there are a lot of people that don't know what they're running (unfortunately) so they just pick one. Ie: when someone else sets up half-life for them. I've encountered a lot of people who just don't know they're running in opengl mode, and they think they're in software, but they'd never seen software; so they didn't know the difference visual wise.
    comment modified on Mon Mar 10, 2003 / 01:19pm PST

    2.

    Skyler 'Zipster' York
    Mon Mar 10, 2003 / 09:41am PST

      Statistics show that the majority of people use software mode. Oh well :)
    comment modified on Sun Mar 16, 2003 / 11:01am PST

    3.

    Chris 'autolycus' Bokitch
    Mon Mar 10, 2003 / 10:02am PST

      The statistics are interesting though. 44.4% of respondants are using software rendering mode, but well over 70% are using video cards that are fully capable of running the game in hardware rendered mode. I guess it's important to note that forcing people to use hardware rendering wouldn't be as cataclysmic a change as you'd first expect. Still though, there are a significant number of low end cards. It just comes down to a question of how much of the market do you want to be accessible to, and what is an acceptable loss.

    4.

    Patrick 'ComCray' Kanne
    Mon Mar 10, 2003 / 11:26am PST

      This IS getting far off-topic but I felt the need to put in my 0.2cts; when looking at these (most interesting and convenient) survey results something started nagging.. It all feels terrible familiar to the whole webdesigners Os-vs-browser-vs-screenresolution-vs-colordepth discussion I actually kinda fled from comming here.. I just want to say two things about this..
    First, please lets not have this discussion since it's so totally dependant on the kindof project you're working on.
    And second, if you DO decide to have this discussion and want to use the majorities and minorities in the statistics to build your point of view: stop looking at them in percentages and think of the sheer amount of persons 5% could present.. I can tell you, once I got straight how much people actually represented the "minority" of Netscape 3 users I NEVER dared using those statistics again.. (it was something along hundreds of thousants..)

    sorry for the OT..

    Cray

    5.

    Eddy 'Cobra' Loughton
    Tue Mar 11, 2003 / 09:46am PST

      Interesting article, but I don't think that the effects of dropping software mode entirely would be that catastrophic, I think that the future of HL is one without a software mode.

    6.

    Laurie Cheers
    Thu Mar 13, 2003 / 06:00am PST

      Hmm... the statistics for "resolution" include 1600x1200. Is it even possible to run HL at that res? It doesn't offer me anything over 1280x1024. (But my video card is certainly capable of 1600x1200, since that's what I run Windows at...)

    7.

    Chris 'autolycus' Bokitch
    Thu Mar 13, 2003 / 09:53am PST

      I have 1600x1200 in my HL video mode list. I think it depends on your video drivers, but I'm not certain. I'm using the NVidia reference drivers.

    8.

    Daniel 'DAN200' Ratcliffe
    Thu Mar 13, 2003 / 10:52am PST

      It was added in the last update or two I believe, but its certainly there if your monitor and such can do it.

    9.

    TMH
    Sat Mar 15, 2003 / 02:43pm PST

      One of my friends can run HL two notches higher. The console text is tiny!

    10.

    Jesse 'EsBe' Kipp
    Sat Mar 15, 2003 / 08:03pm PST

      Software mode is clearly the future. Anyone who denies that is probably a victim of pixel envy.

    11.

    Jon 'trepid_jon' Day
    Sun Apr 13, 2003 / 11:41pm PDT

      One of the reasons Half-Life has stayed so successful is that it can run on fairly old systems. It's pretty weird playing the game in software mode for a while, then switching back to OpenGL.

    Anyway, I just wanted to say that the article omega wrote is pretty good. I did it all and took a screenshot in case someone wants to see it. It's at 1600x1200, too.


    Omega's Orthogonal Example
    comment modified on Sun Apr 13, 2003 / 11:42pm PDT

    12.

    Got Lag?
    Sat Apr 26, 2003 / 05:12am PDT

      One reason software mode might pop up so much: it's the default mode when you install Half-Life, and when you're reinstalling the game it makes sense to patch up before you even run HL for the first time. As the option to participate in the survey is in the patch, I (and I'm assuming others too) just clicked yes before changing the video mode.

    VERC © 2004. All content copyright its respective owner, all rights reserved.
    script execution time: 0.170939207077 seconds