Results 1 to 4 of 4

Thread: glWindowPos2f( ) Question

  1. #1
    Senior Member Regular Contributor
    Join Date
    Sep 2005
    Location
    Dayton
    Posts
    148

    glWindowPos2f( ) Question

    I am working on a project in VIsual Studio 2003 that uses Qt for the GUIs and OpenGL. I am currently using Qt 4.3.0 and am running into some problems using my glRasterPos2f( ) call. I think I am doing some conversion from window coordinates to my ortho coordinates incorrectly, and I was flipping through the red book when I discovered the function glWindowPos2f( ). I figured I should try and use this function since all my original numbers are in window coordinates. Unfortunately, when I try and compile, it says it knows nothing of the function. This is the only OpenGL function I have had it not recognize and I was wondering if anybody here knows what version of OpenGL Qt is using or what I need to add to be able to use glWindowPos2f( ). Thanks!

    Edited Portion:
    I ran a glGetString( GL_VERSION ) on my code to see what version of OpenGL I am using. It returns to me NULL. My code looks like this to check it.

    OpenGL Version = (null)
    Did I do the glGetString incorrectly or what is wrong? Does this mean I don't have any OpenGL installed and that the OpenGL I am using is all being given to me by Qt? Thanks!

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2007
    Posts
    268

    Re: glWindowPos2f( ) Question

    1. glGetString issue:
    Make sure you have an OpenGL context created before any gl* call.

    2. glWindowPos2f() issue:
    If you go through the appendices of the OpenGL spec,
    you'll at section G.14 that this kind of function
    is a core feature of OpenGL 1.4. If your driver version is less than 1.4, you have to use extension
    GL_ARB_window_pos. Remember that Visual studio provides an OpenGL 1.1 header file, anything else has to be detected at runtime and loaded. For this purpose you can use
    glew or do it yourself (by getting some tutorial on the web or studying the source code of glew).

  3. #3
    Senior Member Regular Contributor
    Join Date
    Sep 2005
    Location
    Dayton
    Posts
    148

    Re: glWindowPos2f( ) Question

    I have never used extensions before, so how do I try and call GL_ARB_window_pos? Is it just a function with the same arguments or what? Thanks!

  4. #4
    Senior Member Regular Contributor
    Join Date
    Apr 2007
    Posts
    268

    Re: glWindowPos2f( ) Question

    An extension is a set of additional features to a given OpenGL version.

    Each extension can define new tokens (macros), new functions or just new features.

    For instance extension ARB_texture_non_power_of_two tells you can use non-power-of-two textures but it does not add new tokens or functions.

    Extensions are all listed here:
    http://www.opengl.org/registry

    The extension you are interested in is described here:

    http://www.opengl.org/registry/specs/ARB/window_pos.txt

    This extension defines the following functions:

    Code :
    void WindowPos2dARB(double x, double y)
    void WindowPos2fARB(float x, float y)
    void WindowPos2iARB(int x, int y)
    void WindowPos2sARB(short x, short y)
     
    void WindowPos2dvARB(const double *p)
    void WindowPos2fvARB(const float *p)
    void WindowPos2ivARB(const int *p)
    void WindowPos2svARB(const short *p)
     
    void WindowPos3dARB(double x, double y, double z)
    void WindowPos3fARB(float x, float y, float z)
    void WindowPos3iARB(int x, int y, int z)
    void WindowPos3sARB(short x, short y, short z)
     
    void WindowPos3dvARB(const double *p)
    void WindowPos3fvARB(const float *p)
    void WindowPos3ivARB(const int *p)
    void WindowPos3svARB(const short *p)
    Look at this document http://glew.sourceforge.net/basic.html to learn how to use glew with the extension you want.

    In your case the code should look like:
    Code :
    #include <GL/glew.h>
    GLenum err = glewInit();
    if (err == GLEW_OK)
    {
     if (GLEW_VERSION_1_4)
     {
      glWindowPos2f( );
     }
     else if(GLEW_ARB_window_pos)
      {
      glWindowPos2fARB( );
      }
    }
    ... just a guess from the doc.

Similar Threads

  1. Replies: 5
    Last Post: 04-23-2018, 12:03 AM
  2. Texture question and sphere question...
    By detzel in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-19-2001, 12:02 PM
  3. Matrix question (Not really an OGL Question)
    By KurtCob in forum OpenGL: Basic Coding
    Replies: 22
    Last Post: 04-04-2001, 07:55 AM
  4. Quake3 bsp question (not really openGL question)
    By ribblem in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-15-2001, 10:13 AM
  5. Replies: 2
    Last Post: 01-08-2001, 03:33 PM

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