hi im working with opengl/sdl and im still new to it what im trying to do is to make a 2nd box or sprite that will follow the frist box ive made can anyone help me out here is some of the code i have
#include "sdl.h"
#include "GL_Functions.h"
#include <time.h>
int SDL_main(int argc, char* argv[])
{
//Used in the main loop
bool Done = false;
//Used to store SDL events
SDL_Event event;
//Lets open the window and initialise opengl
InitGL(1024,768);
float colorOffset = 0;
//int face = LoadTexture("block.png");
//GetTimeElapsed();
unsigned int colour = 0;
while(!Done)
{
//Clear the screen
glClear(GL_COLOR_BUFFER_BIT);
//colorOffset += GetTimeElapsed();
glTranslatef (0.0,0.0,0.0);
glRotatef (-0.001,0.0 ,0.0 ,-10.0);
//glBindTexture(GL_TEXTURE_2D, face);
glBegin(GL_QUADS);
//glTexCoord2f(0,0);
glColor3f(1,0,0);
glVertex2i(328,164);
//glTexCoord2f(1,0);
glColor3f(0,1,0);
glVertex2i(584,164);
//glTexCoord2f(1,1);
glColor3f(0,0,1);
glVertex2i(584,420);
//glTexCoord2f(0,1);
glColor3f(0,0,0);
glVertex2i(328,420);
glEnd();
//Present that freshly drawn scene to the screen
SDL_GL_SwapBuffers();
//While we have events (keyboard, mouse, window etc)
while( SDL_PollEvent(&event) )
{
// if the window X was clicked on, ALT_F4 etc
if ( event.type == SDL_QUIT )
Done = true;
//If we have had a key press
if ( event.type == SDL_KEYDOWN )
{
//And the key was escape
if ( event.key.keysym.sym == SDLK_ESCAPE )
Done = true;
}
}
}
SDL_Quit();
return 0;
}