Commit 364f86ca authored by Steven Fuller's avatar Steven Fuller

GL updates

parent 296619ee
......@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <GL/gl.h>
......@@ -32,6 +34,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
int UseSharedTexturePalette = 0;
PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
Byte Pal[768];
/*
Utility Functions
......@@ -50,6 +54,23 @@ void xgluPerspective(GLdouble fovx, GLdouble aspect, GLdouble zNear, GLdouble zF
glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}
int CheckToken(const char *str, const char *item)
{
const char *p;
int len = strlen(item);
p = str;
while ((p = strstr(p, item)) != NULL) {
char x = *(p + len);
char y = (p == str) ? 0 : *(p-1);
if ( ((y == 0) || (isspace(y))) && ((x == 0) || (isspace(x))) )
return 1;
p += len;
}
return 0;
}
/*
Temp Stuff
*/
......@@ -58,8 +79,6 @@ void DisplayScreen(Word res)
{
}
extern Byte Pal[768];
void FadeToPtr(unsigned char *PalPtr)
{
SetPalette(PalPtr);
......@@ -70,6 +89,11 @@ void SetAPalettePtr(unsigned char *PalPtr)
SetPalette(PalPtr);
}
void SetPalette(Byte *pal)
{
memcpy(Pal, pal, 768);
}
void ClearTheScreen(Word c)
{
glClearColor((double)Pal[c*3+0]/255.0, (double)Pal[c*3+1]/255.0, (double)Pal[c*3+2]/255.0, 0.0);
......@@ -145,7 +169,7 @@ void IO_DrawStatusBar(void)
void IO_DisplayViewBuffer(void)
{
BlastScreen();
if (firstframe) {
if (firstframe) {
FadeTo(rGamePal);
firstframe = 0;
}
......
......@@ -21,6 +21,7 @@ TODO:
- When all drawing is implemented, remove any unnecessary state/matrix
changes.
- Split up GLDraw.c
- GL_EXT_shared_texture_palette
* Save/Load Games
* Documentation
* Sound!
......@@ -43,7 +44,10 @@ TODO:
* Different depths/visuals for software clients.
+ Different functions to draw with different bpps.
- 15 bpp uses same draw routes as 16 but different palette one
- not sure how to do palette fades
+ not sure how to do palette fades
- don't support them generally
- MacPlay->Id Logo: have some sort of redraw.
- Fades in game can just call renderview each time
* Get it to compile/work with g++ if it is not too much trouble.
* SDL version (software)
* Mouse
......
......@@ -40,7 +40,8 @@ XVisualInfo *vi;
GLXContext ctx;
Atom wmDeleteWindow;
Byte Pal[768];
extern int UseSharedTexturePalette;
extern PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
int attrib[] = {
GLX_RGBA,
......@@ -199,11 +200,6 @@ void Quit(char *str)
exit(EXIT_SUCCESS);
}
void SetPalette(Byte *pal)
{
memcpy(Pal, pal, 768);
}
void BlastScreen2(Rect *BlastRect)
{
BlastScreen();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment