- #include "SDL.h"
- #include "SDL_opengl.h"
- int main(int argc, char* args[])
- {
- SDL_Init(SDL_INIT_EVERYTHING);
- SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
- SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8);
- SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8);
- SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8);
- SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32);
- SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1);
- SDL_WM_SetCaption("Color", NULL);
- SDL_SetVideoMode(600, 400, 32, SDL_OPENGL );
- glClearColor(1,1,1,1);
- glViewport(0,0,600,400);
- glShadeModel(GL_SMOOTH);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
- bool isRunning = true;
- SDL_Event event;
- while( isRunning )
- {
- // Event
- while( SDL_PollEvent(&event) )
- {
- if ( event.type == SDL_QUIT )
- {
- isRunning = false;
- }
- if (event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_ESCAPE)
- {
- isRunning = false;
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_q)
- {
- glClearColor(1,0,0,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_w)
- {
- glClearColor(0,1,0,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_e)
- {
- glClearColor(0,0,1,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_a)
- {
- glClearColor(0,0,0,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_s)
- {
- glClearColor(1,1,1,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_d)
- {
- glClearColor(1,0,1,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_z)
- {
- glClearColor(1,1,0,1);
- }
- if(event.type = SDL_KEYUP && event.key.keysym.sym == SDLK_x)
- {
- glClearColor(0,1,1,1);
- }
- }
- // Render
- glClear(GL_COLOR_BUFFER_BIT);
- SDL_GL_SwapBuffers();
- }
- SDL_Quit();
- return 0;
- }
Sursa/executabil (TOT) :http://www.2shared.com/file/FVyR39ID/Color_C.html
Welcome to BitCell. Click here to register !
.

. Dap. That's a good question. Este un nume al unei companii (pe care sper sa o conduc in viitorul indepartat-oarecum). Stiu ca o sa radeti de mine dar mie imi place cum suna. Mai concret, este numele companiei pe care vreau sa o construiesc. Am realizat si unele demersuri in acest sens (de ordin minor, evident). Odata transformasem DNG-ul intr-un acronim (Dynamic Nearby Generation) dar am renuntat ulterior la asta pentru ca nu mi s-a parut potrivit. In orice caz nu am luat programul de la vreo firma cu numele asta (daca la asta te gandeai) sau ceva de genul; pot posta codul daca vrei dar, cum am mai zis, nu prea e inteligibil.