Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: math-to-OpenGL guide

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    Ohio
    Posts
    8

    math-to-OpenGL guide

    Hi. Does anyone know of a book or online resource that shows a mathematical expression immediately followed by its code implementation in OpenGL?
    Mark Key

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

    Re: math-to-OpenGL guide

    Can you explain what sort of maths you want done in GL ? GPU calculations with complex shaders, or plotting a graph, or blending textures ?

    Maybe try http://www.gpgpu.org/

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    Ohio
    Posts
    8

    Re: math-to-OpenGL guide

    Here's an example of what I have in mind.

    Let's take vector math as an example...
    Suppose I'm learning about cross-product (which I am) and I see something in a book that states, given vectors A and B -

    the formula for calculating cross-product is:
    cross.x = (A.y * B.z) - (B.y * A.z)
    cross.y = (A.z * B.x) - (B.z * A.x)
    cross.z = (A.x * B.y) - (B.x * A.y)

    and the way to express this through OpenGL API functions is (I'm just making something up below, because I have no idea):
    GL_VECTOR A
    GL_VECTOR B
    GL_VECTOR CROSS = glCrossProduct(A, B)
    - now I can access my GL_VECTOR.x, GL_VECTOR.y and GL_VECTOR.z values

    I'd like to see a lot of core math applied in this way so I can understand how to render different concepts via OpenGL.

    I hope this makes sense.
    Thanks.
    Mark Key

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Aug 2004
    Location
    munich, germany
    Posts
    658

    Re: math-to-OpenGL guide

    you're expecting way too much- opengl is not a math library. you have to implement your cross or dot products by yourself or find a freeware library that does.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    Ohio
    Posts
    8

    Re: math-to-OpenGL guide

    Most introductory-level graphics API books have a chapter on 3D math. They explain vectors, normals, matrices, translation, rotation and quaternions. They discuss the math involved in the object space/world space calculations.

    What I'm looking for is an OpenGL code snippet for each of these math concepts. I want to be able to put the math and the code side-by-side and understand how the graphics API is expressing/displaying the math.

    If there's no such book or online resource, I'll be sure to write one myself and cash-in once I figure it out. :-)
    Mark Key

  6. #6
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    Ohio
    Posts
    8

    Re: math-to-OpenGL guide

    Sweet! I found exactly what I was looking for.

    There's a GREAT web resource with reams of pages! This resource explains basic to advanced graphics math, each math concept accompanied by the OpenGL function that performs it. It directly relates the math constituents to the OpenGL function's parameters.

    This will be an invaluable aid to a newbie like me.
    Mark Key

  7. #7
    Junior Member Regular Contributor
    Join Date
    Mar 2002
    Posts
    102

    Re: math-to-OpenGL guide

    There is a book/library called OpenGeometry. It might have some things you are looking for.

  8. #8
    Junior Member Newbie
    Join Date
    Oct 2004
    Location
    india
    Posts
    1

    Re: math-to-OpenGL guide

    Which GREAT web resource about maths and opengl you found. Can you post that link on the forum? So that it will be helpfull to all newbies like me.

  9. #9
    Junior Member Newbie
    Join Date
    Sep 2004
    Location
    Ohio
    Posts
    8

    Re: math-to-OpenGL guide

    For those who requested it, below is information about the site I found.
    ***PLEASE NOTE: Because this site and its materials are accessible through the internet, I'm assuming it is open to the public.

    The site is not easy to navigate, nor is the entire site about OpenGL. Therefore, you will need to browse through the URL structure and see what's of use to you.

    Pages 13, 14, 18, 23, 26, 28, 30, 31, 39, ... of the following file fit well into what I was looking for:
    < http://cs.hofstra.edu/courses/2003/f...lect54hand.pdf >
    Mark Key

  10. #10
    Junior Member Newbie
    Join Date
    Oct 2004
    Location
    China
    Posts
    13

    Re: math-to-OpenGL guide

    I can't open this site, so i can't get the resouces.
    Could you email me a copy of it?
    you can send to my email:
    shichongdong80@hotmail.com <2M
    or
    shichongdong80@gmail.com >2M

Posting Permissions

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