Where is HGLRC (opengl handle to render context) defined ?????

Posted on 2009-12-20
Last Modified: 2013-12-06
I'm porting some opengl code to assembler, I'm using winasm (masm).
I'm using,, opengl23.lib and glu32.lib
I can't find where the opengl render context handle type is defined (HGLRC) I can't seem to get the code working without it. I've tried declaring it as a DWORD as most handles are but it doesn't work.
Question by:RonHoffmann
    LVL 14

    Assisted Solution


    Is it here:

    typedef void *HANDLE;
    #define DECLARE_HANDLE(name) typedef HANDLE name

    LVL 4

    Author Comment

    Thanks that's great.
    would you know if there is an assembler version of the file
    It would save me a lot of time converting from the .h.

    Assisted Solution

    DWORD is good, because the handle is a simple integer.
    LVL 14

    Expert Comment

    > would you know if there is an assembler version of the file

    Not sure about assembler. Can't you just use the equivalent of the above typedef code?

    LVL 20

    Expert Comment

    Hey RonHoffmann,

    the OpenGL lessons at nehe all have an asm-ports:

    Here is lesson 2 "Your first Polygon" in assembler, including headers:

    Here is the actual lesson:

    Hope it helps :)
    LVL 20

    Assisted Solution

    Here is how they store the return value of wglCreateContext, the "HGLRC hRC;"

    the handles are declared here:

      hDC      dd ?
      hRC      dd ?

    and hRC is initialized here:

          push [hDC]
          call wglCreateContext
          or eax,eax
          jnz @@10
          call KillGLWindow
          push MB_OK or MB_ICONEXCLAMATION
          push offset ER
          push offset CCRC
          push L 0
          call MessageBox
          mov ax,-1
          mov hRC,eax
    LVL 4

    Author Comment

    after digging deeper... a lot deeper
    I think the problem I'm having is with my inc and lib files.
    specifically and glu32.lib
    the function ordinals don't match up and the inc file has twice as many arguments as necessary defined for each function.
    I'll try reinstalling masm and winasm ide
    I guess what I really need is a matched set of glu32 files ( .inc, .lib, .dll ) unless my assembler/linker are messed up.
    LVL 4

    Accepted Solution

    Point increase for sharing

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
    This is an explanation of a simple data model to help parse a JSON feed
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now