Hi People
I started to learn openGL and OpenAL. I would appreciate your help.
I am coding OpenGL and OpenAL in console environment (visual c++). Just wondered how to combine those OpenGL and OpenAL mains functions. I mean the only way is that for example use alutInit() and glutInit() together or I can modularize them?
Another question, My little simple program shows a cube rotating. I added a few lines and using glutKeyboardFunc(keyfunc) called below function:
void keyfunc (unsigned char key, int x , int y)
{
switch(key)
{
case 's':
play();
break;
default:
break;
}
}
and The play() function:
void play()
{
ALuint helloBuffer, helloSource;
helloBuffer = alutCreateBufferHelloWorld ();
alGenSources (1, &helloSource);
alSourcei (helloSource, AL_BUFFER, helloBuffer);
alSourcePlay (helloSource);
alutSleep (1);
alutExit ();
}
It sounds weird to me. when I push ‘s’ the whole screen stops, the function plays the sound and again animation starts. I want the animation remain in action while the sound is playing. what should I do?
P.S: I used alutInit() in main function.