Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F96983
GLShader.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
GLShader.cpp
View Options
#include
<echo/Platforms/GL/GLShader.h>
#include
<echo/Graphics/Shader.h>
#ifdef ECHO_GL_SUPPORTS_VERTEX_SHADER
namespace
Echo
{
GLShader
::
GLShader
(
GLenum
shaderType
)
:
mVersion
(
0
)
{
mShaderHandle
=
glCreateShader
(
shaderType
);
}
GLShader
::~
GLShader
()
{
glDeleteShader
(
mShaderHandle
);
}
bool
GLShader
::
Compile
(
const
Shader
&
shader
)
{
if
(
shader
.
GetSource
().
empty
())
return
false
;
const
char
*
source
=
shader
.
GetSource
().
c_str
();
glShaderSource
(
mShaderHandle
,
1
,
(
const
GLchar
**
)
&
source
,
0
);
glCompileShader
(
mShaderHandle
);
int
compiled
=
0
;
glGetObjectParameterivARB
(
mShaderHandle
,
GL_OBJECT_COMPILE_STATUS_ARB
,
&
compiled
);
if
(
compiled
)
{
mVersion
=
shader
.
GetVersion
();
return
true
;
}
else
{
mVersion
=
0
;
}
return
false
;
}
std
::
string
GLShader
::
GetErrors
()
{
if
(
mShaderHandle
==
0
)
return
""
;
GLint
logLength
=
0
;
glGetObjectParameterivARB
(
mShaderHandle
,
GL_OBJECT_INFO_LOG_LENGTH_ARB
,
&
logLength
);
if
(
logLength
>
1
)
{
char
*
compilerLog
=
new
char
[
logLength
];
GLint
outLogLength
=
0
;
glGetInfoLogARB
(
mShaderHandle
,
logLength
,
&
outLogLength
,
compilerLog
);
std
::
string
logAsString
(
compilerLog
);
delete
[]
compilerLog
;
return
logAsString
;
}
return
""
;
}
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Dec 5, 5:03 PM (11 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63315
Default Alt Text
GLShader.cpp (1 KB)
Attached To
Mode
rEE Echo 3
Attached
Detach File
Event Timeline
Log In to Comment