Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
48b35204
Commit
48b35204
authored
5 years ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Stop using NextTexAvail
parent
8350a8c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!892
Funny shaders master merge
,
!828
Replace NextTexAvail with glGenTextures
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hardware/r_opengl/r_opengl.c
+15
-30
15 additions, 30 deletions
src/hardware/r_opengl/r_opengl.c
with
15 additions
and
30 deletions
src/hardware/r_opengl/r_opengl.c
+
15
−
30
View file @
48b35204
...
@@ -63,7 +63,6 @@ static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
...
@@ -63,7 +63,6 @@ static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
// **************************************************************************
// **************************************************************************
static
GLuint
NextTexAvail
=
FIRST_TEX_AVAIL
;
static
GLuint
tex_downloaded
=
0
;
static
GLuint
tex_downloaded
=
0
;
static
GLfloat
fov
=
90
.
0
f
;
static
GLfloat
fov
=
90
.
0
f
;
#if 0
#if 0
...
@@ -72,8 +71,8 @@ static FRGBAFloat const_pal_col;
...
@@ -72,8 +71,8 @@ static FRGBAFloat const_pal_col;
#endif
#endif
static
FBITFIELD
CurrentPolyFlags
;
static
FBITFIELD
CurrentPolyFlags
;
static
FTextureInfo
*
gr_cachetail
=
NULL
;
static
FTextureInfo
*
gr_cachetail
=
NULL
;
static
FTextureInfo
*
gr_cachehead
=
NULL
;
static
FTextureInfo
*
gr_cachehead
=
NULL
;
RGBA_t
myPaletteData
[
256
];
RGBA_t
myPaletteData
[
256
];
GLint
screen_width
=
0
;
// used by Draw2DLine()
GLint
screen_width
=
0
;
// used by Draw2DLine()
...
@@ -243,6 +242,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
...
@@ -243,6 +242,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
/* 1.1 functions */
/* 1.1 functions */
/* texture objects */
//GL_EXT_texture_object
/* texture objects */
//GL_EXT_texture_object
#define pglGenTextures glGenTextures
#define pglDeleteTextures glDeleteTextures
#define pglDeleteTextures glDeleteTextures
#define pglBindTexture glBindTexture
#define pglBindTexture glBindTexture
/* texture mapping */
//GL_EXT_copy_texture
/* texture mapping */
//GL_EXT_copy_texture
...
@@ -359,6 +359,8 @@ static PFNglFogfv pglFogfv;
...
@@ -359,6 +359,8 @@ static PFNglFogfv pglFogfv;
/* 1.1 functions */
/* 1.1 functions */
/* texture objects */
//GL_EXT_texture_object
/* texture objects */
//GL_EXT_texture_object
typedef
void
(
APIENTRY
*
PFNglGenTextures
)
(
GLsizei
n
,
const
GLuint
*
textures
);
static
PFNglGenTextures
pglGenTextures
;
typedef
void
(
APIENTRY
*
PFNglDeleteTextures
)
(
GLsizei
n
,
const
GLuint
*
textures
);
typedef
void
(
APIENTRY
*
PFNglDeleteTextures
)
(
GLsizei
n
,
const
GLuint
*
textures
);
static
PFNglDeleteTextures
pglDeleteTextures
;
static
PFNglDeleteTextures
pglDeleteTextures
;
typedef
void
(
APIENTRY
*
PFNglBindTexture
)
(
GLenum
target
,
GLuint
texture
);
typedef
void
(
APIENTRY
*
PFNglBindTexture
)
(
GLenum
target
,
GLuint
texture
);
...
@@ -487,6 +489,7 @@ boolean SetupGLfunc(void)
...
@@ -487,6 +489,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC
(
pglFogf
,
glFogf
)
GETOPENGLFUNC
(
pglFogf
,
glFogf
)
GETOPENGLFUNC
(
pglFogfv
,
glFogfv
)
GETOPENGLFUNC
(
pglFogfv
,
glFogfv
)
GETOPENGLFUNC
(
pglGenTextures
,
glGenTextures
)
GETOPENGLFUNC
(
pglDeleteTextures
,
glDeleteTextures
)
GETOPENGLFUNC
(
pglDeleteTextures
,
glDeleteTextures
)
GETOPENGLFUNC
(
pglBindTexture
,
glBindTexture
)
GETOPENGLFUNC
(
pglBindTexture
,
glBindTexture
)
...
@@ -723,33 +726,12 @@ void Flush(void)
...
@@ -723,33 +726,12 @@ void Flush(void)
while
(
gr_cachehead
)
while
(
gr_cachehead
)
{
{
// this is not necessary at all, because you have loaded them normally,
if
(
gr_cachehead
->
downloaded
)
// and so they already are in your list!
pglDeleteTextures
(
1
,
(
GLuint
*
)
&
gr_cachehead
->
downloaded
);
#if 0
//Hurdler: 25/04/2000: now support colormap in hardware mode
FTextureInfo *tmp = gr_cachehead->nextskin;
// The memory should be freed in the main code
while (tmp)
{
pglDeleteTextures(1, &tmp->downloaded);
tmp->downloaded = 0;
tmp = tmp->nextcolormap;
}
#endif
pglDeleteTextures
(
1
,
(
GLuint
*
)
&
gr_cachehead
->
downloaded
);
gr_cachehead
->
downloaded
=
0
;
gr_cachehead
->
downloaded
=
0
;
gr_cachehead
=
gr_cachehead
->
nextmipmap
;
gr_cachehead
=
gr_cachehead
->
nextmipmap
;
}
}
gr_cachetail
=
gr_cachehead
=
NULL
;
//Hurdler: well, gr_cachehead is already NULL
gr_cachetail
=
gr_cachehead
=
NULL
;
//Hurdler: well, gr_cachehead is already NULL
NextTexAvail
=
FIRST_TEX_AVAIL
;
#if 0
if (screentexture != FIRST_TEX_AVAIL)
{
pglDeleteTextures(1, &screentexture);
screentexture = FIRST_TEX_AVAIL;
}
#endif
tex_downloaded
=
0
;
tex_downloaded
=
0
;
}
}
...
@@ -1128,8 +1110,10 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
...
@@ -1128,8 +1110,10 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
static
RGBA_t
tex
[
2048
*
2048
];
static
RGBA_t
tex
[
2048
*
2048
];
const
GLvoid
*
ptex
=
tex
;
const
GLvoid
*
ptex
=
tex
;
INT32
w
,
h
;
INT32
w
,
h
;
GLuint
texnum
=
0
;
//DBG_Printf ("DownloadMipmap %d %x\n",NextTexAvail,pTexInfo->grInfo.data);
pglGenTextures
(
1
,
&
texnum
);
//DBG_Printf ("DownloadMipmap %d %x\n",(INT32)texnum,pTexInfo->grInfo.data);
w
=
pTexInfo
->
width
;
w
=
pTexInfo
->
width
;
h
=
pTexInfo
->
height
;
h
=
pTexInfo
->
height
;
...
@@ -1217,9 +1201,10 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
...
@@ -1217,9 +1201,10 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
else
else
DBG_Printf
(
"SetTexture(bad format) %ld
\n
"
,
pTexInfo
->
grInfo
.
format
);
DBG_Printf
(
"SetTexture(bad format) %ld
\n
"
,
pTexInfo
->
grInfo
.
format
);
pTexInfo
->
downloaded
=
NextTexAvail
++
;
// the texture number was already generated by pglGenTextures
tex_downloaded
=
pTexInfo
->
downloaded
;
pglBindTexture
(
GL_TEXTURE_2D
,
texnum
);
pglBindTexture
(
GL_TEXTURE_2D
,
pTexInfo
->
downloaded
);
pTexInfo
->
downloaded
=
texnum
;
tex_downloaded
=
texnum
;
// disable texture filtering on any texture that has holes so there's no dumb borders or blending issues
// disable texture filtering on any texture that has holes so there's no dumb borders or blending issues
if
(
pTexInfo
->
flags
&
TF_TRANSPARENT
)
if
(
pTexInfo
->
flags
&
TF_TRANSPARENT
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment