Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9218671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:55:04+00:00 2026-06-18T02:55:04+00:00

I am trying to call a callback function from void display(void){ my_draw(&here_is_the_actual_drawing); } void

  • 0

I am trying to call a callback function from

 void display(void){

    my_draw(&here_is_the_actual_drawing);

 }

 void here_is_the_actual_drawing(){

    glVertex2f(x,y);

 }

in main the opengl loop call display .. like

 glutDisplayFunc(display); 

My question is can we do this ?? I tried in my code it compiles but gets stuck .. [ my_draw will create a thread that will call here_is_the_actual_drawing —- ok so no threads just call back ]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:55:05+00:00Added an answer on June 18, 2026 at 2:55 am

    my_draw will create a thread that will call here_is_the_actual_drawing —- ok so no threads just call back ]

    You can not simply just call OpenGL commands from any thread. OpenGL needs a context, and each OpenGL context can be active in only one thread at a time. It is perfectly possible to migrate a context between threads. However this requires that you have full control over context creation and management.

    By using a simple framework like (Free)GLUT, GLFW or SDL you do not have control over context management. But technically it is possible.

    But not everything whats possible makes sense. Usually keeping all OpenGL operations to a single thread, to be precise the main GUI thread, is the best solution. Multithreaded OpenGL is usefull in only a very small number of situations, and even then only with very limited circumstances.

    BTDT (actually my current project makes heavy use of multithreaded OpenGL)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do the following: function main(callback) { $.ajax('server-side', function() { this.callback.call(hello);
I am trying to call a setTimeout from within a setInterval callback: function callback()
I'm trying to call a function present in one class from another class by
I am trying to call c# function from javascript the code i have tried
I am currently trying to call a function from a C# DLL from an
I'm trying to make a call to a DLL function (via GetProcAddress etc) from
What I was trying to do here is to call a function from client,
I'm trying to call a registered JS function when a c++ callback is called,
I'm trying to call a function in my ActionScript from my JavaScript, I've managed
I am trying to learn how to call this write_data(…) function from the funmain()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.