PDA

View Full Version : Using OpenGL with SDL as keyboard input



Grim_Scythe
02-13-2008, 10:47 AM
I am noob and my professor is pretty much useless telling us to search online for tutorials rather than him teach us....whoa such a concept.

Anyhow i am a bit of noob again with intergrating SDL with OpenGL . I need to use SDL as my keyboard input.

My program I am working on is having basically 3 3-D cubes of varying heights and depths. That part seems easy since it's in OpenGL but my problem is trying to add SDL code into it...so it read user inputs....

Currently I am using windows header file in order to create my window

Help would be very much appreciated.

Grim_Scythe
02-13-2008, 11:21 AM
Well here's what I successfully made into this now to have this draw do I just place my draw function call at the end of the switch function?

int SDL_main( int argc, char* argv[] )
{
if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
return FAILURE ;

SDL_Surface* Screen = NULL ;

Screen = SDL_SetVideoMode( 640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF ) ;

if( Screen == NULL )
return FAILURE ;

//******************************************CODE added in************************************************ ************
bool done = false;
// Main event loop
SDL_Event event;
//while((!done) && (SDL_WaitEvent(&event))) {
while((!done))
{
if(SDL_PollEvent(&event) != 0)
{
switch(event.type)
{

case SDL_QUIT:
done = true;
break;

default:
break;
} // End switch
// PLACE DISPLAY/DRAW functions here????
}
}

SDL_Quit() ;
return SUCCESS ;
}