It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I've got a program that simulates collisions (circles) using openGL, GLUT, GLUI. Everything worked fine but when I changed my code a bit it began to do weird things.
I have 2 buttons, "play" and "step", "play" simulates the collisions updated with a timer, "step" also simulates but you've got to click it in order to go further.
Originally it did that but now the "play" button acts the same as "step". If I add a printf in my timer callback it all works perfectly...
What can I do ?
In my timer_cb I only have got :
// printf("something\n");
glutPostRedisplay();
glutTimerFunc(getDeltaT(), timer_cb, 0);
The I/O routines, like printf, introduce a sensible delay by calling them. To answer with a certain degree of correctness you show us the User Interface code, but I think I can guess...
Are you using threads? Maybe it can be a concurrency bug because the execution of the button event handler is not synchronized with the update logic?
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
This might be a really stupid question, but I can't find any info on this, and I can't find out what to search for.
How do you make something real time? For example, say we have a game, how does it run continuously without us calling a tick() method at different parts of the program?
If you are developing the program to run at a time in particular the best way I know of is to develop it to run at a particular loop rate using timed delays.
IE:
while(forever) {
do something
test how long it took
take up the remainder amount of time for the loop to run at a rate (ie 100Hz)
}
If you are desperate for real time applications you can develop and use QNX:
http://www.qnx.com/
But this certainly wouldn't be a good environment for programming games.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I wish to creat a countdown timer in OpenGL. So I am just looking for a function that will be called every second based on the system clock which will decrease a set variable. I tried fiddling with glutTimerfunc but itcalls back only once. I need a similar setup but one that calls back multiple times.
Timers and timer functions are neither defined by C++ nor by OpenGL but rather by the operating system you are using.
However, since GLUT seems to define one, and you are using it, here we go:
In your timer function passed to glutTimerFunc, just call glutTimerFunc with the same parameters again. That way you will end up creating an infinite loop of timer callbacks.
Use some global variable or the int value passed to the timer function to determine when to break the loop.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am developing one audio processing utility in Qt(C++). I can hear audio from speaker when I speak through mike using my qt code. I need to apply echo effect to this audio output. In my code I am receiving audio using a 16 bit byte array.
How I can apply echo effect to this sound sample.
I think the simplest way to make an echo is to play the sound twice, near-simultaneously, with a slight delay between the two instances. You might also make the volume of the second instance a bit less than the first instance.
You can do this by either mixing the sample stream together with itself (with an offset) and then playing the result, or possibly by creating two QAudioOutput devices and playing the sound in both of them (I haven't tried the latter though, so I don't know for sure if it would work)
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am new to opengl I tried to make an isosurface by reading from a text file .now I want to introdude keyboard functions in my code so that I can rotate an do all that stuffs. please tell me from where i can study that or give me a sample code
Sudhanshu
OpenGL only deals with drawing stuff. It gives you a canvas and some primitive drawing tools. Nothing more. Anything beyond that is the task of the user interface system provided by the OS.
Maybe you're using GLUT and are mislead by its name. GLUT is not part of OpenGL; it's a rudimentary framework aimed at developing simple OpenGL example programs, but that's about it.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm not c++ programmer so I have problem. Simple problem, I think.
I need play movie, can be only e.g. .avi (I can convert). Static width, static height, no button, no loop. I will write in PHP something like
exec('window.exe movie23.avi');
And appears window, play video, window close.
I rely code or good links.
Best regards
So you are a PHP programmer who needs to make a small window ( written in C++ ) that will play a video provided by the command line. Look into the animation control on msdn. It plays avi files. If you are completely inexperienced in the topic , then you have a lot to learn. I would say that you could write something like this in under 200 lines of code.
Best of luck....