Results 1 to 2 of 2

Thread: how to pass information to draw function()

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005

    how to pass information to draw function()

    I have developed a C++ program which calculate coordinates for number of points. Now I want to display the points using openGL. In the openGL examples I have gone through, there is no mention of passing information to draw() function from the function which calls it. All the examples contain draw() as a top level function which calls other functions(which themselves contain the whole logic). In my case, one of the functions will calculate the coordinates for points and these points should get displayed. How can I pass the coordinates to draw() so that it would be accessible to draw funcion?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Naarn, Austria

    Re: how to pass information to draw function()

    How are you calling the draw() function?

    If you use GLUT, then there is no other way than to use a global variable or use the singleton design pattern. I recommend using SDL or writing the windowing code yourself, then you can pass whatever you want to the draw function or even call a C++ draw method...

Similar Threads

  1. Replies: 4
    Last Post: 05-18-2012, 01:13 AM
  2. Function selection per pass
    By babis in forum OpenGL: GLSL
    Replies: 7
    Last Post: 03-07-2008, 09:04 AM
  3. gDEBugger V2.3 Adds OpenGL Function Calls Statistics Information
    By Graphic Remedy in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-08-2006, 12:45 AM
  4. Replies: 18
    Last Post: 03-28-2003, 09:34 AM
  5. Pass parameter to function related with glutDisplayFunc
    By Jane Liu in forum OpenGL: Linux
    Replies: 1
    Last Post: 03-25-2003, 08:27 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