Results 1 to 5 of 5

Thread: MD2 weapons rendering

  1. #1
    Guest

    MD2 weapons rendering

    Hi there!

    I wonder how to render quake 2 weapons, as they are in quake 2. I mean they stay in the right place on screen. But of course they are actually rotated (for light applying). And my question is how to do this. Well, i tried just glRotate, glTranslate etc... but models should be centered at (0,0,0) or the results aren't like they should be. Should I use the info from each frame (scale and translate vectors)???

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    germany
    Posts
    26

    Re: MD2 weapons rendering

    Hi

    try

    glLoadIdentity
    glTranslatef
    glRotatef

    draw your world

    glClear(GL_DEPTH_BUFFER_BIT)
    glLoadIdentity
    glTranslatef
    glRotatef

    draw your weapon

    it's just one way

    LB

  3. #3
    Guest

    Re: MD2 weapons rendering

    Actually, one of the easiest ways is to draw it before you rotate and translate your scene/camera. Usually at the very beggining of your scene code ,right after Clear Color|detph and loadIdentity and right before you're camera/scene translations.

    Assuming it's a first person jig, then,it will always be right at point origin and "staty there" since its drawn before any camera/scene or world translations/rotations.

  4. #4
    Guest

    Re: MD2 weapons rendering

    Well, to be more precisely:

    When I load a md2 model (decompresing vertices to full float format - using scale and transalte vectors of frame) I get a Big F*** Gun, virtually. The gun is quite big and not centered. So I should translate model to make it near (0,0,0) for proper rotation. But how will I know how much to translate it. Hard-coded?, ok. But if i will want to load another weapon. I think this post represents problem more exact.

  5. #5
    Guest

    Re: MD2 weapons rendering

    You can translate/rotate/scale the weapon as much as you like and it will not rotate/translate/scale with the rest of the scene because it's drawn before scene/camera rotations.

    It will always be at/near point origin in the above scenario after you move to there.

    to know "how much" you should translate/rotate/scale... is done according to personal preferences.

    But, check and mess around with your near plane value as well, if you're using glu perspective...Cahnge it from 0.1f upwards, little by little.

Similar Threads

  1. Replies: 5
    Last Post: 05-25-2018, 06:55 PM
  2. FPS: Camera rotation and weapons
    By PascalM123 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-06-2010, 02:19 AM
  3. Structure for storing weapons
    By Leyder Dylan in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-31-2002, 06:48 AM
  4. Render weapons in players viewport
    By Luminous Blue in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 07-24-2002, 02:25 PM
  5. [3TE]-Weapons section updated!
    By Cem UZUNLAR in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 04-01-2001, 05:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean