   Emulator Graphics using OpenGL
  Hi, Im in the process of learning to program a console emulator. I have the CPU core, input done and so on, I initially used SDL to plot pixels upon a a byte array which i magnified and plotted using the SDL api.The only problem is that each for pixel in my virtual screen array (64x32 pixels), i have to iterate through my actual screen pixels (320x160). Thats ~100 million iterations before the screen is completely drawn.What I have decided to do is use the openGL api and use a textured quad for my screen and stretch the 64x32 texture to the 320x160 quad.The virtual screen array is defined: unsigned char Screen[64*32];And each byte within the Screen array is either a 1 or a 0. My DrawScene and InitScene functions are below. Could someone please help me to load my Screen Array to a texture and blit it to the quad I have created. Many Regards, LiamV.  void InitScene(){int vPort[4];glGetIntegerv(GL_VIEWPORT, vPort);glMatrixMode(GL_PROJECTION);glPushMatrix();glLoadIdentity();glOrtho(0, vPort[2], 0, vPort[3], -1, 1);glMatrixMode(GL_MODELVIEW);glPushMatrix();glLoadIdentity();}void DrawScene(){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();glEnable(GL_TEXTURE_2D);// Load Texture hereglBegin(GL_QUADS);  glTexCoord2d(0,0);  glVertex2d(0,0); //BLglTexCoord2d(0,1);  glVertex2d(0,160);    //TL  glTexCoord2d(1,1);glVertex2d(320,160);//TR  glTexCoord2d(1,0);glVertex2d(320,0);//BRglEnd();glDisable(GL_TEXTURE_2D);SwapBuffers(g_HDC);return;}[edited by - LiamV on May 29, 2004 1:50:50 PM][edited by - LiamV on May 29, 2004 1:53:40 PM][edited by - LiamV on May 29, 2004 1:56:01 PM]
  Loading an array from system memory to video memory is very slow. Instead, I would suggest doing all of your drawing in OpenGL if you can. It is sort of pointless to use the CPU to draw your image and the GPU just to strech it. I suggest either using only OpenGL or only 2D/SDL/GDI. See if SDL has something like StrechBlit. I think it does, but that''s the wrong name. ;  Thanks for that, it seems to work fine by stretching the SDL Surface. But for future reference could someone please answer my original problem by using OpenGL? 