//#define sqrt(x) __builtin_sqrtf(x)
//#define expf(x) __builtin_expf(x)
+#define SCREEN_WIDTH 1280
+#define SCREEN_HEIGHT 720
+
float current_t;
+#define renderTexture 1
+
+typedef struct
+{
+ float s,t,aux1,aux2; // tex coords
+ float c1,c2,c3,c4; // color
+ float n1,n2,n3; // normal
+ float v1,v2,v3,aux3; // vertice
+} VertexInfo;
+
+#define MODEL_SIZE 1000000
+
+VertexInfo gurru1[MODEL_SIZE];
+VertexInfo gurru2[MODEL_SIZE];
+
+void initTextures()
+{
+ fn.glEnable(GL_TEXTURE_2D);
+}
+
+void initModels()
+{
+ // init gurrus
+ for(float u=0.0;u<10.0;u++)
+ {
+ for(float v=0.0;v<10.0;v++)
+ {
+ // calc superquadric for gurru1
+ // calc superquadric for gurru2
+ }
+ }
+}
+
+void endRenderTexture()
+{
+ fn.glBindTexture(renderTexture);
+ fn.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+}
+
+void drawScene()
+{
+ if(current_t<10.0)
+ {
+ fn.glRotatef(current_t,1.0,1.0,1.0);
+ fn.glInterleavedArrays(GL_T4F_C4F_N3F_V4F,0,gurru1);
+ }
+ else if(current_t>=10.0 && current_t<20.0)
+ {
+ fn.glInterleavedArrays(GL_T4F_C4F_N3F_V4F,0,gurru2);
+ }
+}
+
+void drawPostProcess()
+{
+}
+
#ifdef DEBUG
int main()
#else
fn.SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
fn.SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
fn.SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL,1);
- fn.SDL_SetVideoMode(1280,960,32,SDL_OPENGL);
+ fn.SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,32,SDL_OPENGL);
fn.SDL_ShowCursor(0);
+ initTextures();
+ initModels();
+
while(1)
{
current_t = fn.SDL_GetTicks()/1000.0f;
if (event.type == SDL_KEYDOWN)
goto end;
}
+ drawScene();
+ endRenderTexture();
+ drawPostProcess();
fn.SDL_GL_SwapBuffers();
}