version 1.11 | | version 1.12 |
---|
| | |
#ifndef _OGL_INIT_H_ | | #ifndef _OGL_INIT_H_ |
#define _OGL_INIT_H_ | | #define _OGL_INIT_H_ |
| | |
| | #ifdef __WINDOWS__ |
| | #include <windows.h> |
| | #include <stddef.h> |
| | #endif |
| | |
| | //#ifdef __WINDOWS__ |
| | //#define OGL_RUNTIME_LOAD |
| | //#endif |
| | |
| | #ifdef OGL_RUNTIME_LOAD |
| | #include "loadgl.h" |
| | int ogl_init_load_library(void); |
| | #else |
| | #include <GL/gl.h> |
| | #endif |
| | |
#include "gr.h" | | #include "gr.h" |
#include "palette.h" | | #include "palette.h" |
#include <GL/gl.h> | | #include "types.h" |
| | |
| | |
| | #define OGL_TEXTURE_LIST_SIZE 2000 |
| | |
| | typedef struct _ogl_texture { |
| | int handle; |
| | GLint internalformat; |
| | GLenum format; |
| | int w,h,tw,th; |
| | GLfloat u,v; |
| | GLfloat prio; |
| | int wrapstate; |
| | fix lastrend; |
| | ulong numrend; |
| | } ogl_texture; |
| | |
| | extern ogl_texture ogl_texture_list[OGL_TEXTURE_LIST_SIZE]; |
| | |
| | extern int ogl_mem_target; |
| | ogl_texture* ogl_get_free_texture(void); |
| | void ogl_init_texture(ogl_texture* t); |
| | void ogl_init_texture_list_internal(void); |
| | |
| | |
| | |
| | extern int ogl_alttexmerge;//merge textures by just printing the seperate textures? |
| | extern int ogl_16bittextures; |
| | |
extern int gl_initialized; | | extern int gl_initialized; |
extern int GL_texmagfilt,GL_texminfilt,GL_needmipmaps; | | extern int GL_texmagfilt,GL_texminfilt,GL_needmipmaps; |
| | |
extern int GL_TEXTURE_2D_enabled; | | extern int GL_TEXTURE_2D_enabled; |
extern int GL_texclamp_enabled; | | //extern int GL_texclamp_enabled; |
//extern int GL_TEXTURE_ENV_MODE_state,GL_TEXTURE_MAG_FILTER_state,GL_TEXTURE_MIN_FILTER_state; | | //extern int GL_TEXTURE_ENV_MODE_state,GL_TEXTURE_MAG_FILTER_state,GL_TEXTURE_MIN_FILTER_state; |
#define OGL_ENABLE2(a,f) {if (a ## _enabled!=1) {f;a ## _enabled=1;}} | | #define OGL_ENABLE2(a,f) {if (a ## _enabled!=1) {f;a ## _enabled=1;}} |
#define OGL_DISABLE2(a,f) {if (a ## _enabled!=0) {f;a ## _enabled=0;}} | | #define OGL_DISABLE2(a,f) {if (a ## _enabled!=0) {f;a ## _enabled=0;}} |
| | |
#define OGL_ENABLE(a) OGL_ENABLE2(a,glEnable(a)) | | //#define OGL_ENABLE(a) OGL_ENABLE2(a,glEnable(a)) |
#define OGL_DISABLE(a) OGL_DISABLE2(a,glDisable(a)) | | //#define OGL_DISABLE(a) OGL_DISABLE2(a,glDisable(a)) |
| | #define OGL_ENABLE(a) OGL_ENABLE2(GL_ ## a,glEnable(GL_ ## a)) |
| | #define OGL_DISABLE(a) OGL_DISABLE2(GL_ ## a,glDisable(GL_ ## a)) |
| | |
#define OGL_TEXCLAMP() OGL_ENABLE2(GL_texclamp,glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);) | | //#define OGL_TEXCLAMP() OGL_ENABLE2(GL_texclamp,glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);) |
#define OGL_TEXREPEAT() OGL_DISABLE2(GL_texclamp,glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);) | | //#define OGL_TEXREPEAT() OGL_DISABLE2(GL_texclamp,glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);) |
| | |
#define OGL_SETSTATE(a,s,f) {if (a ## _state!=s) {f;a ## _state=s;}} | | //#define OGL_SETSTATE(a,s,f) {if (a ## _state!=s) {f;a ## _state=s;}} |
| | |
//#define OGL_TEXENV(p,m) OGL_SETSTATE(p,m,glTexEnvi(GL_TEXTURE_ENV, p,m)); | | //#define OGL_TEXENV(p,m) OGL_SETSTATE(p,m,glTexEnvi(GL_TEXTURE_ENV, p,m)); |
//#define OGL_TEXPARAM(p,m) OGL_SETSTATE(p,m,glTexParameteri(GL_TEXTURE_2D,p,m)); | | //#define OGL_TEXPARAM(p,m) OGL_SETSTATE(p,m,glTexParameteri(GL_TEXTURE_2D,p,m)); |
| | |
extern int last_width,last_height; | | extern int last_width,last_height; |
#define OGL_VIEWPORT(x,y,w,h){if (w!=last_width || h!=last_height){glViewport(x,y,w,h);last_width=w;last_height=h;}} | | #define OGL_VIEWPORT(x,y,w,h){if (w!=last_width || h!=last_height){glViewport(x,grd_curscreen->sc_canvas.cv_bitmap.bm_h-y-h,w,h);last_width=w;last_height=h;}} |
| | |
//platform specific funcs | | //platform specific funcs |
//MSVC seems to have problems with inline funcs not being found during linking | | //MSVC seems to have problems with inline funcs not being found during linking |
| | |
#define OGLTEXBUFSIZE (1024*1024*4) | | #define OGLTEXBUFSIZE (1024*1024*4) |
extern GLubyte texbuf[OGLTEXBUFSIZE]; | | extern GLubyte texbuf[OGLTEXBUFSIZE]; |
//void ogl_filltexbuf(unsigned char *data,GLubyte *texp,int width,int height,int twidth,int theight); | | //void ogl_filltexbuf(unsigned char *data,GLubyte *texp,int width,int height,int twidth,int theight); |
void ogl_filltexbuf(unsigned char *data,GLubyte *texp,int truewidth,int width,int height,int dxo,int dyo,int twidth,int theight); | | void ogl_filltexbuf(unsigned char *data,GLubyte *texp,int truewidth,int width,int height,int dxo,int dyo,int twidth,int theight,int type); |
void ogl_loadbmtexture_m(grs_bitmap *bm,int domipmap); | | void ogl_loadbmtexture_m(grs_bitmap *bm,int domipmap); |
void ogl_loadbmtexture(grs_bitmap *bm); | | void ogl_loadbmtexture(grs_bitmap *bm); |
void ogl_loadtexture(unsigned char * data, int width, int height,int dxo,int dyo, int *texid,float *u,float *v,int domipmap); | | //void ogl_loadtexture(unsigned char * data, int width, int height,int dxo,int dyo, int *texid,float *u,float *v,char domipmap,float prio); |
void ogl_freetexture(int *gltexture); | | void ogl_loadtexture(unsigned char * data, int dxo,int dyo, ogl_texture *tex,char domipmap); |
| | void ogl_freetexture(ogl_texture *gltexture); |
void ogl_freebmtexture(grs_bitmap *bm); | | void ogl_freebmtexture(grs_bitmap *bm); |
void ogl_do_palfx(void); | | void ogl_do_palfx(void); |
void ogl_start_frame(void); | | void ogl_start_frame(void); |
| | |
void ogl_ulinec(int left,int top,int right,int bot,int c); | | void ogl_ulinec(int left,int top,int right,int bot,int c); |
| | |
extern unsigned char *ogl_pal; | | extern unsigned char *ogl_pal; |
| | |
| | #include "3d.h" |
| | bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,grs_bitmap *bmbot,grs_bitmap *bm,int orient); |
| | |
//whee | | //whee |
//#define PAL2Tr(c) ((gr_palette[c*3]+gr_palette_gamma)/63.0) | | //#define PAL2Tr(c) ((gr_palette[c*3]+gr_palette_gamma)/63.0) |