Thread: OGL Question

  1. #1

    OGL Question

    I've noticed a function in OpenGL that has f after each parameter like so - glVertex3f(1.0f,1.0f,1.0f); - does anybody know what the f's mean and why the need to put them there and also what difference it would make without them?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    It means float.
    I don't think there's any difference between 1.0 and 1.0f, but there is a difference between 1 and 1f.
    In the first example, both are floats. In the second, the first is an int and the second is a float.

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Veni Vidi Vice
    Join Date
    Aug 2001
    Type conversion to float. If you donīt convert, the numbers is treated as double.

  4. #4
    I lurk
    Join Date
    Aug 2002
    OpenGL follows a naming convention for all of its functions...
    Example from "OpenGL Superbible 2nd edition":


    This means it's part of the gl library
    This is referred to the "root command"
    This is the number of arguments
    This is the type of arguments, as Magos said

    Without the postfixes on numbers like 1.0f, they are created as the first type which can hold the specified value. So you're basically saying, create the value 1.0 and make it the size of a float.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  3. Question...
    By TechWins in forum A Brief History of
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 01:36 PM
  5. Question, question!
    By oskilian in forum A Brief History of
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM