Děkuji!!! Problém vyřešen
Příspěvky odeslané z IP adresy 195.178.65.–
void Draw()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//glCullFace(GL_BACK);
//glEnable(GL_CULL_FACE);
keys=SDL_GetKeyState(NULL);
if (keys[SDLK_UP])
{ xpos-=ryc*sin(uhel*DEG_TO_RAD);
zpos-=ryc*cos(uhel*DEG_TO_RAD);}
if (keys[SDLK_DOWN])
{ xpos+=ryc*sin(uhel*DEG_TO_RAD);
zpos+=ryc*cos(uhel*DEG_TO_RAD);}
if (keys[SDLK_RIGHT]&&(keys[SDLK_UP]||keys[SDLK_DOWN]))
uhel-=(keys[SDLK_DOWN]?-polo:polo);
if (keys[SDLK_LEFT]&&(keys[SDLK_UP]||keys[SDLK_DOWN]))
uhel+=(keys[SDLK_DOWN]?-polo:polo);
if (uhel>360) uhel-=360;
strom(2.0f,-1.0f);
strom(-4.0f,-5.0f);
strom(-1.0f,-16.0f);
strom(1.0f,-20.0f);
strom(-7.0f,-40.0f);
strom(-3.0f,-29.0f);
glLoadIdentity();
glTranslatef(0.0f,-1.001f,-5.0f);
glRotatef(360-uhel,0.0f,1.0f,0.0f);
glTranslatef(-xpos,0.0f,-zpos);
glBegin(GL_QUADS);
glColor3f(1.0f,1.0f,1.0f);
glTexCoord2i(0,0);
glVertex3f(-12.8f, 0.0f, 0.0f);
glTexCoord2i(1,0);
glVertex3f( 10.0f, 0.0f, 0.0f);
glTexCoord2i(1,1);
glVertex3f( 10.0f, 0.0f,-25.6f);
glTexCoord2i(0,1);
glVertex3f(-12.8f, 0.0f,-25.6f);
glEnd();
glLoadIdentity();
glTranslatef(0.0f,-1.0f,-5.0f);
glBegin(GL_QUADS);
glColor3f(0.2f,0.2f,1.0f);
glVertex3f(-0.4f, 0.2f, 0.0f);
glColor3f(0.0f,0.0f,0.4f);
glVertex3f(-0.4f, 0.0f, 0.0f);
glVertex3f( 0.0f, 0.0f,-2.0f);
glColor3f(0.2f,0.2f,1.0f);
glVertex3f( 0.0f, 0.2f,-2.0f);
glVertex3f( 0.0f, 0.2f,-2.0f);
glColor3f(0.0f,0.0f,0.4f);
glVertex3f( 0.0f, 0.0f,-2.0f);
glVertex3f( 0.4f, 0.0f, 0.0f);
glColor3f(0.2f,0.2f,1.0f);
glVertex3f( 0.4f, 0.2f, 0.0f);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(0.0f,0.0f,0.4f);
glVertex3f( 0.0f,0.0f,-2.0f);
glVertex3f(-0.4f,0.0f, 0.0f);
glVertex3f( 0.4f,0.0f, 0.0f);
glEnd();
glFlush();
SDL_GL_SwapBuffers();
}
void loadTexture()
{
if ( (surface = SDL_LoadBMP("map.bmp")) )
{
// Have OpenGL generate a texture object handle for us
glGenTextures(1, &texture);
// Bind the texture object
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D( GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_BGR, GL_UNSIGNED_BYTE, surface->pixels);
}
else
{
printf("SDL could not load texture %s\n", SDL_GetError());
SDL_Quit();
}
if (surface) SDL_FreeSurface(surface);
}
Zdravím potřeboval bych poradit jak vytvořit program pro odměření časového intervalu pomocí časového spínače 0 bez přerušení.
Hodnoty: Mod 2
kmitočet 12MHz
časový interval 150 mikrosekund