The problem is that we DON'T understand what you wrote. Is this something you made? Is this just something you found and thought was cool and wanted to share?
What's the purpose? Is it supposed to be a SNES emulator running on the GPU? Etc?
I've taken a look at the source code and feel qualified to answer on OP's behalf.
To answer your questions: Yes. No, yes, and yes. Retro-style graphics library. No.
Basically what we have here is software rendering library that draws quads for every emulated pixel. The library can support up to fifteen layers. It's fancy though because it uses vertex buffers and OpenGL.
If anybody wants a taste of what the code is like without downloading, you should look no farther than Lesson45.cpp@300. The code should speak for the quality of the library itself:
bool CMesh :: LoadHeightmap( char* szPath, float flHeightScale, float flResolution )
{
m_nVertexCount = (int) wdt*hgt*4;
m_pVertices = new CVec[m_nVertexCount];
m_pLayer1 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 2)
m_pLayer2 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 3)
m_pLayer3 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 4)
m_pLayer4 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 5)
m_pLayer5 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 6)
m_pLayer6 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 7)
m_pLayer7 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 8)
m_pLayer8 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 9)
m_pLayer9 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 10)
m_pLayer10 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 11)
m_pLayer11 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 12)
m_pLayer12 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 13)
m_pLayer13 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 14)
m_pLayer14 = new CColor[m_nVertexCount];
if(NUM_LAYERS >= 15)
m_pLayer15 = new CColor[m_nVertexCount];
mLayers[0] = m_pLayer1;
mLayers[1] = m_pLayer2;
mLayers[2] = m_pLayer3;
mLayers[3] = m_pLayer4;
mLayers[4] = m_pLayer5;
mLayers[5] = m_pLayer6;
mLayers[6] = m_pLayer7;
mLayers[7] = m_pLayer8;
mLayers[8] = m_pLayer9;
mLayers[9] = m_pLayer10;
mLayers[10] = m_pLayer11;
mLayers[11] = m_pLayer12;
mLayers[12] = m_pLayer13;
mLayers[13] = m_pLayer14;
mLayers[14] = m_pLayer15;
for(int y=0; y< hgt; ++y)
{
for(int x=0; x< wdt; ++x)
{
m_pVertices[y*wdt*4 + x*4 + 0].x = (float)x;
m_pVertices[y*wdt*4 + x*4 + 0].y = (float)y;
m_pVertices[y*wdt*4 + x*4 + 0].z = 0.0f;
m_pVertices[y*wdt*4 + x*4 + 0].w = 1.0f;
m_pVertices[y*wdt*4 + x*4 + 1].x = (float)x+1.0f;
m_pVertices[y*wdt*4 + x*4 + 1].y = (float)y;
m_pVertices[y*wdt*4 + x*4 + 1].z = 0.0f;
m_pVertices[y*wdt*4 + x*4 + 1].w = 1.0f;
m_pVertices[y*wdt*4 + x*4 + 2].x = (float)x+1.0f;
m_pVertices[y*wdt*4 + x*4 + 2].y = (float)y+1.0f;
m_pVertices[y*wdt*4 + x*4 + 2].z = 0.0f;
m_pVertices[y*wdt*4 + x*4 + 2].w = 1.0f;
m_pVertices[y*wdt*4 + x*4 + 3].x = (float)x;
m_pVertices[y*wdt*4 + x*4 + 3].y = (float)y+1.0f;
m_pVertices[y*wdt*4 + x*4 + 3].z = 0.0f;
m_pVertices[y*wdt*4 + x*4 + 3].w = 1.0f;
for(int i=0; i<NUM_LAYERS; ++i)
{
mLayers[i][y*wdt*4 + x*4 + 0].r = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 0].g = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 0].b = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 0].a = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 1].r = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 1].g = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 1].b = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 1].a = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 2].r = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 2].g = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 2].b = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 2].a = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 3].r = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 3].g = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 3].b = 0.0f;
mLayers[i][y*wdt*4 + x*4 + 3].a = 0.0f;
}
}
}
return true;
}
DirectX/NVIDIA license needed but it's 12FPS if you don't have license...
What? No! It's 12 FPS because you're loading image resources
every frame
and you're blitting those images in software. Both of those things are terribly slow! Lesson45.cpp@188:
// Render
int width, height;
unsigned char *ht_map = LoadImg(".\\imgs\\water.png", &width, &height);
BlitTest(g_pMesh->mLayers, 0, width, height, 0, height, ht_map);
BlitTest(g_pMesh->mLayers, 0, width, height, 0, 0, ht_map);
for(int y=0; y< hgt/height; ++y)
{
for(int x=0; x< wdt/width; ++x)
{
BlitTest(g_pMesh->mLayers, 0, width, height, x*width, y*height, ht_map);
}
}
unsigned char *penguin = LoadImg(".\\imgs\\penguin.png", &width, &height);
//for(int i=1; i< NUM_LAYERS; ++i)
//BlitTest(g_pMesh->mLayers, i, width, height, 315+i*2, 235+i*2, penguin);
for(int i=1; i< NUM_LAYERS; ++i)
BlitTest(g_pMesh->mLayers, i, width, height, -30+i*2, -5+i*2, penguin);
FreeImg( ht_map );
FreeImg( penguin );
/*
char temp[100];
sprintf(temp, "%d %d", width, height);
MessageBox(NULL, temp, temp, MB_OK);
*/
/*
BlitTest(g_pMesh->mLayers, 0, width, height, 0, 0, ht_map);
BlitTest(g_pMesh->mLayers, 0, width, height, 0, height, ht_map);*/
glBindVertexArray(g_pMesh->m_nVAO);
glBindBufferARB(GL_ARRAY_BUFFER, g_pMesh->m_nVBOVertices);
glBufferDataARB(GL_ARRAY_BUFFER, sizeof(CVec)*g_pMesh->m_nVertexCount, (GLvoid*)g_pMesh->m_pVertices, GL_STATIC_DRAW);
glVertexAttribPointerARB(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArrayARB(0);
for(int i=0;i<NUM_LAYERS;++i)
{
glBindBufferARB(GL_ARRAY_BUFFER, g_pMesh->m_nColors[i]);
glBufferDataARB(GL_ARRAY_BUFFER, sizeof(CVec)*g_pMesh->m_nVertexCount, (GLvoid*)g_pMesh->mLayers[i], GL_STATIC_DRAW);
glVertexAttribPointerARB(i+1, 4, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArrayARB(i+1);
}
glDrawArrays( GL_QUADS, 0, g_pMesh->m_nVertexCount ); // Draw All Of The Triangles At Once
SwapBuffers (g_window->hDC); // Swap Buffers (Double Buffering)