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. ...@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h> #include <math.h>
#include <GL/gl.h> #include <GL/gl.h>
...@@ -32,6 +34,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -32,6 +34,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
int UseSharedTexturePalette = 0; int UseSharedTexturePalette = 0;
PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
Byte Pal[768];
/* /*
Utility Functions Utility Functions
...@@ -50,6 +54,23 @@ void xgluPerspective(GLdouble fovx, GLdouble aspect, GLdouble zNear, GLdouble zF ...@@ -50,6 +54,23 @@ void xgluPerspective(GLdouble fovx, GLdouble aspect, GLdouble zNear, GLdouble zF
glFrustum(xmin, xmax, ymin, ymax, zNear, zFar); 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 Temp Stuff
*/ */
...@@ -58,8 +79,6 @@ void DisplayScreen(Word res) ...@@ -58,8 +79,6 @@ void DisplayScreen(Word res)
{ {
} }
extern Byte Pal[768];
void FadeToPtr(unsigned char *PalPtr) void FadeToPtr(unsigned char *PalPtr)
{ {
SetPalette(PalPtr); SetPalette(PalPtr);
...@@ -70,6 +89,11 @@ void SetAPalettePtr(unsigned char *PalPtr) ...@@ -70,6 +89,11 @@ void SetAPalettePtr(unsigned char *PalPtr)
SetPalette(PalPtr); SetPalette(PalPtr);
} }
void SetPalette(Byte *pal)
{
memcpy(Pal, pal, 768);
}
void ClearTheScreen(Word c) 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); 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) ...@@ -145,7 +169,7 @@ void IO_DrawStatusBar(void)
void IO_DisplayViewBuffer(void) void IO_DisplayViewBuffer(void)
{ {
BlastScreen(); BlastScreen();
if (firstframe) { if (firstframe) {
FadeTo(rGamePal); FadeTo(rGamePal);
firstframe = 0; firstframe = 0;
} }
......
...@@ -21,6 +21,7 @@ TODO: ...@@ -21,6 +21,7 @@ TODO:
- When all drawing is implemented, remove any unnecessary state/matrix - When all drawing is implemented, remove any unnecessary state/matrix
changes. changes.
- Split up GLDraw.c - Split up GLDraw.c
- GL_EXT_shared_texture_palette
* Save/Load Games * Save/Load Games
* Documentation * Documentation
* Sound! * Sound!
...@@ -43,7 +44,10 @@ TODO: ...@@ -43,7 +44,10 @@ TODO:
* Different depths/visuals for software clients. * Different depths/visuals for software clients.
+ Different functions to draw with different bpps. + Different functions to draw with different bpps.
- 15 bpp uses same draw routes as 16 but different palette one - 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. * Get it to compile/work with g++ if it is not too much trouble.
* SDL version (software) * SDL version (software)
* Mouse * Mouse
......
...@@ -40,7 +40,8 @@ XVisualInfo *vi; ...@@ -40,7 +40,8 @@ XVisualInfo *vi;
GLXContext ctx; GLXContext ctx;
Atom wmDeleteWindow; Atom wmDeleteWindow;
Byte Pal[768]; extern int UseSharedTexturePalette;
extern PFNGLCOLORTABLEEXTPROC pglColorTableEXT;
int attrib[] = { int attrib[] = {
GLX_RGBA, GLX_RGBA,
...@@ -199,11 +200,6 @@ void Quit(char *str) ...@@ -199,11 +200,6 @@ void Quit(char *str)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
void SetPalette(Byte *pal)
{
memcpy(Pal, pal, 768);
}
void BlastScreen2(Rect *BlastRect) void BlastScreen2(Rect *BlastRect)
{ {
BlastScreen(); 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