Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
99371f89
Commit
99371f89
authored
12 years ago
by
Jonathan Goodman
Browse files
Options
Downloads
Patches
Plain Diff
Added new bindTexture and unbindTexture API to LLGLSLShader. Reviewed by davep.
parent
ed1b78e3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llrender/llglslshader.cpp
+52
-0
52 additions, 0 deletions
indra/llrender/llglslshader.cpp
indra/llrender/llglslshader.h
+8
-1
8 additions, 1 deletion
indra/llrender/llglslshader.h
with
60 additions
and
1 deletion
indra/llrender/llglslshader.cpp
+
52
−
0
View file @
99371f89
...
@@ -476,6 +476,58 @@ void LLGLSLShader::bindNoShader(void)
...
@@ -476,6 +476,58 @@ void LLGLSLShader::bindNoShader(void)
}
}
}
}
S32
LLGLSLShader
::
bindTexture
(
const
std
::
string
&
uniform
,
LLTexture
*
texture
,
LLTexUnit
::
eTextureType
mode
)
{
S32
channel
=
0
;
channel
=
getUniformLocation
(
uniform
);
return
bindTexture
(
channel
,
texture
,
mode
);
}
S32
LLGLSLShader
::
bindTexture
(
S32
uniform
,
LLTexture
*
texture
,
LLTexUnit
::
eTextureType
mode
)
{
if
(
uniform
<
0
||
uniform
>=
(
S32
)
mTexture
.
size
())
{
UNIFORM_ERRS
<<
"Uniform out of range: "
<<
uniform
<<
LL_ENDL
;
return
-
1
;
}
uniform
=
mTexture
[
uniform
];
if
(
uniform
>
-
1
)
{
gGL
.
getTexUnit
(
uniform
)
->
bind
(
texture
,
mode
);
}
return
uniform
;
}
S32
LLGLSLShader
::
unbindTexture
(
const
std
::
string
&
uniform
,
LLTexUnit
::
eTextureType
mode
)
{
S32
channel
=
0
;
channel
=
getUniformLocation
(
uniform
);
return
unbindTexture
(
channel
);
}
S32
LLGLSLShader
::
unbindTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
)
{
if
(
uniform
<
0
||
uniform
>=
(
S32
)
mTexture
.
size
())
{
UNIFORM_ERRS
<<
"Uniform out of range: "
<<
uniform
<<
LL_ENDL
;
return
-
1
;
}
uniform
=
mTexture
[
uniform
];
if
(
uniform
>
-
1
)
{
gGL
.
getTexUnit
(
uniform
)
->
unbind
(
mode
);
}
return
uniform
;
}
S32
LLGLSLShader
::
enableTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
)
S32
LLGLSLShader
::
enableTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
)
{
{
if
(
uniform
<
0
||
uniform
>=
(
S32
)
mTexture
.
size
())
if
(
uniform
<
0
||
uniform
>=
(
S32
)
mTexture
.
size
())
...
...
This diff is collapsed.
Click to expand it.
indra/llrender/llglslshader.h
+
8
−
1
View file @
99371f89
...
@@ -130,7 +130,14 @@ class LLGLSLShader
...
@@ -130,7 +130,14 @@ class LLGLSLShader
//the corresponding channel will be active upon return
//the corresponding channel will be active upon return
//returns channel texture is enabled in from [0-MAX)
//returns channel texture is enabled in from [0-MAX)
S32
enableTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
S32
enableTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
S32
disableTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
S32
disableTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
// bindTexture returns the texture unit we've bound the texture to.
// You can reuse the return value to unbind a texture when required.
S32
bindTexture
(
const
std
::
string
&
uniform
,
LLTexture
*
texture
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
S32
bindTexture
(
S32
uniform
,
LLTexture
*
texture
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
S32
unbindTexture
(
const
std
::
string
&
uniform
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
S32
unbindTexture
(
S32
uniform
,
LLTexUnit
::
eTextureType
mode
=
LLTexUnit
::
TT_TEXTURE
);
BOOL
link
(
BOOL
suppress_errors
=
FALSE
);
BOOL
link
(
BOOL
suppress_errors
=
FALSE
);
void
bind
();
void
bind
();
...
...
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