[DEV] update shader IO
This commit is contained in:
parent
9fc1003fbb
commit
961cf3e007
@ -40,7 +40,7 @@ namespace gale {
|
||||
void display();
|
||||
/**
|
||||
* @brief Reload all resources from files, and send there in openGL card if needed.
|
||||
* @note If file is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
|
||||
* @note If file is reference at THEME_XXX:///filename if the Theme change the file will reload the newOne
|
||||
*/
|
||||
void reLoadResources();
|
||||
/**
|
||||
|
@ -66,7 +66,9 @@ void gale::resource::Program::init(const etk::Uri& _uri) {
|
||||
return;
|
||||
}
|
||||
etk::String tmpData;
|
||||
GALE_DEBUG("===========================================================");
|
||||
while (fileIO->gets(tmpData) != false) {
|
||||
GALE_DEBUG("data: " << tmpData);
|
||||
int32_t len = tmpData.size();
|
||||
if( tmpData[len-1] == '\n'
|
||||
|| tmpData[len-1] == '\r') {
|
||||
@ -83,6 +85,11 @@ void gale::resource::Program::init(const etk::Uri& _uri) {
|
||||
// get it with relative position:
|
||||
etk::Uri tmpUri = _uri;
|
||||
tmpUri.setPath(_uri.getPath().getParent() / tmpData);
|
||||
GALE_VERBOSE("base path: " << _uri);
|
||||
GALE_VERBOSE("base path: " << _uri.getPath());
|
||||
GALE_VERBOSE("base path: " << _uri.getPath().getParent());
|
||||
GALE_VERBOSE("new path: " << _uri.getPath().getParent() / tmpData);
|
||||
GALE_VERBOSE("create shader: " << tmpUri);
|
||||
ememory::SharedPtr<gale::resource::Shader> tmpShader = gale::resource::Shader::create(tmpUri.get());
|
||||
if (tmpShader == null) {
|
||||
GALE_ERROR("Error while getting a specific shader filename : " << tmpUri);
|
||||
@ -91,6 +98,7 @@ void gale::resource::Program::init(const etk::Uri& _uri) {
|
||||
m_shaderList.pushBack(tmpShader);
|
||||
}
|
||||
}
|
||||
GALE_DEBUG("===========================================================");
|
||||
// close the file:
|
||||
fileIO->close();
|
||||
}
|
||||
|
@ -102,11 +102,12 @@ void gale::resource::Shader::removeContextToLate() {
|
||||
void gale::resource::Shader::reload() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
etk::Uri uri = m_name;
|
||||
if (etk::uri::exist(uri)) {
|
||||
if (etk::uri::exist(uri) == false) {
|
||||
GALE_CRITICAL("File does not Exist : '" << uri << "' : path='" << uri.getPath() << "'");
|
||||
return;
|
||||
}
|
||||
etk::uri::readAll(uri, m_fileData);
|
||||
GALE_VERBOSE("load shader:\n-----------------------------------------------------------------\n" << m_fileData << "\n-----------------------------------------------------------------");
|
||||
// now change the OGL context ...
|
||||
if (gale::openGL::hasContext() == true) {
|
||||
GALE_DEBUG("OGL : load SHADER '" << m_name << "' ==> call update context (direct)");
|
||||
|
@ -31,7 +31,7 @@ namespace appl {
|
||||
void onCreate(gale::Context& _context) override {
|
||||
setSize(vec2(800, 600));
|
||||
m_angle = 0.0f;
|
||||
m_GLprogram = gale::resource::Program::create("DATA:basic.prog");
|
||||
m_GLprogram = gale::resource::Program::create("DATA:///basic.prog");
|
||||
if (m_GLprogram != null) {
|
||||
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
|
||||
m_GLColor = m_GLprogram->getAttribute("EW_color");
|
||||
|
Loading…
Reference in New Issue
Block a user