Archived

This topic is now archived and is closed to further replies.

Anton_suv

OpenAL&GL

Recommended Posts

Anton_suv    122
Posted - 10/10/2003 : 06:50:23 AM -------------------------------------------------------------------------------- i use OpenGL... after the code my 3d application doesn''t want render,... there is nothing appears in GL window but the music is normaly playing!... /*======INITIALIZATION OPENGL====*/ SetListenerValues(); // Setup an exit procedure. atexit(KillALData); /*======END INITIALIZATION OPENGL====*/ //============render my scene===================== // Begin the source playing. alSourcePlay(Source); /*===============END======================*/ //||||||||||||WIN API|||||||||||||||||||||||||||| // Loop ALint time = 0; ALint elapse = 0; while(!kbhit()) { elapse += clock() - time; time += elapse; if(elapse > 50) { elapse = 0; SourcePos[0] += SourceVel[0]; SourcePos[1] += SourceVel[1]; SourcePos[2] += SourceVel[2]; alSourcefv(Source, AL_POSITION, SourcePos); } } //||||||||||||||||||||||||||END|||||||||||||||||||||||||||||| test

Share this post


Link to post
Share on other sites
Anton_suv    122
here it is!
-----------------------------------------
int DrawGLScene(GLvoid)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-5.0f);
drawScene();
/////////////////sound/////////////////
SetListenerValues();

atexit(KillALData);

alSourcePlay(Source);

ALint time = 0;
ALint elapse = 0;

while(!kbhit())
{
elapse += clock() - time;
time += elapse;

if(elapse > 50)
{
elapse = 0;
SourcePos[0] += SourceVel[0];
SourcePos[1] += SourceVel[1];
SourcePos[2] += SourceVel[2];
alSourcefv(Source, AL_POSITION, SourcePos);
}
}
//////////////////////////////////////////////////

Share this post


Link to post
Share on other sites