Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: math with Gl datatypes

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2005
    Posts
    3

    math with Gl datatypes

    how do i perform standard math functions like abs() or sqrt() on something like GLfloat ?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: math with Gl datatypes

    Actually this is pretty simple, head over gl.h to see how GLfloat is defined, in fact it is a good old float.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2005
    Posts
    3

    Re: math with Gl datatypes

    Originally posted by ZbuffeR:
    Actually this is pretty simple, head over gl.h to see how GLfloat is defined, in fact it is a good old float.
    well i see its a float, but it still doenst compile when i try to perform abs(GLfloat number)
    or any other function from math.h library

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: math with Gl datatypes

    try this, maybe forget about r1 :
    Code :
    GLfloat f1 =0.3f;
    float r1;
    double r2;
    r1 = abs((float)f1);
    r2 = abs((double)f1);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •