1 /*******************************************************************************
2 **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
3 ** 10 20 30 40 50 60 70 80
9 ** Mirco "MacSlow" Mueller <macslow@bangang.de>
11 ** copyright (C) Mirco Mueller, July 2006, placed under the terms of the LGPL
13 *******************************************************************************/
18 #include "SDL_opengl.h"
19 #include "opengl-rendering.h"
21 /* now this here is _really_ nasty, but I'm too lazy to do it right */
22 #define GL_TEXTURE_RECTANGLE_ARB 0x84F5
27 printf ("OpenGL version: %s\n", glGetString (GL_VERSION
));
28 printf ("OpenGL vendor: %s\n", glGetString (GL_VENDOR
));
29 printf ("OpenGL renderer: %s\n", glGetString (GL_RENDERER
));
31 glClearColor (0.0f
, 0.0f
, 0.0f
, 0.0f
);
32 glDisable (GL_DEPTH_TEST
);
34 glBlendFunc (GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
);
35 glEnable (GL_TEXTURE_RECTANGLE_ARB
);
39 draw_func (int iWidth
,
41 unsigned char* pucSurfaceData
,
42 unsigned int uiTextureId
)
46 printf ("draw_func() - No valid pointer to surface-data passed\n");
50 glMatrixMode (GL_MODELVIEW
);
52 glClear (GL_COLOR_BUFFER_BIT
);
56 glBindTexture (GL_TEXTURE_RECTANGLE_ARB
, uiTextureId
);
57 glTexImage2D (GL_TEXTURE_RECTANGLE_ARB
,
67 glColor3f (0.25f
, 0.5f
, 1.0f
);
69 glTexCoord2f (0.0f
, 0.0f
);
70 glVertex2f (0.0f
, 0.0f
);
71 glTexCoord2f ((GLfloat
) iWidth
, 0.0f
);
72 glVertex2f (1.0f
, 0.0f
);
73 glTexCoord2f ((GLfloat
) iWidth
, (GLfloat
) iHeight
);
74 glVertex2f (1.0f
, 1.0f
);
75 glTexCoord2f (0.0f
, (GLfloat
) iHeight
);
76 glVertex2f (0.0f
, 1.0f
);
85 resize_func (int iWidth
,
87 unsigned int* puiTextureId
)
89 glViewport (0, 0, iWidth
, iHeight
);
90 glMatrixMode (GL_PROJECTION
);
92 glOrtho (0.0f
, 1.0f
, 0.0f
, 1.0f
, -1.0f
, 1.0f
);
94 glClear (GL_COLOR_BUFFER_BIT
);
96 glDeleteTextures (1, puiTextureId
);
97 glGenTextures (1, puiTextureId
);
98 glBindTexture (GL_TEXTURE_RECTANGLE_ARB
, *puiTextureId
);
99 glTexImage2D (GL_TEXTURE_RECTANGLE_ARB
,
108 glTexEnvi (GL_TEXTURE_ENV
, GL_TEXTURE_ENV_MODE
, GL_DECAL
);