Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sagaceil

Member Since 04 May 2009
Offline Last Active May 20 2016 05:40 AM

Posts I've Made

In Topic: Error with shaders - OpenGL

11 September 2015 - 07:38 AM

try:


        std::string vertSourceString = FileUtils::read_file(m_VertPath);
        std::string fragSourceString = FileUtils::read_file(m_FragPath);

        const char* vertSource = vertSourceString.c_str();
        const char* fragSource = fragSourceString.c_str();

        glShaderSource(vertex, 1, &vertSource , NULL);


In Topic: Error with shaders - OpenGL

11 September 2015 - 01:05 AM


        const char* vertSource = FileUtils::read_file(m_VertPath).c_str();
        const char* fragSource = FileUtils::read_file(m_FragPath).c_str();

 

It seems like strings are created from function, then you getting c_str of them. Now strings are destroyed, but pointers are still in use. Try to do something like:

const std::string vertSource = FileUtils::read_file(m_VertPath);
const std::string fragSource = FileUtils::read_file(m_FragPath); 

// ... 

glShaderSource(vertex, 1, &vertSource.c_str(), NULL); // same for fragment

// ... 

This way, strings are remaninbg for whole function scope and keeps valid c_str pointers.


In Topic: Using compressed and non compressed mipmaps

21 November 2013 - 10:54 AM

When Im importing textures to engine, Im doing offline compression using close fit range compression. So I have to ananlize whole 4x4 blocks as an input. When loading textures , they are in compressed format arleady, and the last mipmaps are stored as a raw RGB(A) data.


In Topic: Using compressed and non compressed mipmaps

21 November 2013 - 07:37 AM

Ok, solved.

 

I'm uploading compressed mipmaps using glCompressedTex* ( mipmaps with size >= 4px ) and using glTexImage* with GL_COMPRESSED_RGB(A) for lower mipmaps.


In Topic: Using compressed and non compressed mipmaps

21 November 2013 - 05:28 AM

So actually theres no way to use compressed textures and use lower size than 4px. I supposue that compression require 4x4 px blocks to be compressed.


PARTNERS