Jump to content

  • Log In with Google      Sign In   
  • Create Account


Aroidzap

Member Since 30 Apr 2012
Offline Last Active Sep 20 2014 03:02 AM

Topics I've Started

C++ how to avoid calling destructor

29 January 2013 - 12:43 PM

Hi, I've got code like this :

 

 

std::vector<some_class> array;

void pushback_function()
{
    some_class temp;
    array.push_back(temp);
}

 

Is it somehow possible to avoid calling destructor of temp


Loading Texture (SDL surface to OpenGL)

26 January 2013 - 03:03 AM

Hi, I can't figure out why this code throws me an exception. Can you help me?

 

TEXTURE LoadTexture(const char* file)
{
    TEXTURE texture;       // GLuint texture, int width, int height

    if ( IMG_Load(file) )
    {
        SDL_Surface* surface = IMG_Load(file);
        GLuint tex;
        
        glGenTextures(1, &tex);
        glBindTexture(GL_TEXTURE_2D, tex);

THROWS EXCEPTION at this point -> glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, surface->w, surface->h);

        glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, GL_RGBA, GL_UNSIGNED_BYTE, 
                         surface->pixels);
        
        glGenerateMipmap(GL_TEXTURE_2D);


        GLfloat maxAniso;
        glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAniso);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);


        texture.texture=tex;
        texture.width=surface->w;
        texture.height=surface->h;


        SDL_FreeSurface(surface);
    }
    else
    {
        texture.texture=0;
        texture.width=0;
        texture.height=0;
    }
    return texture;
}
 

Mipmaps

19 January 2013 - 02:58 AM

Hi, what is typical number of mipmaps? (including base level)


UBO location

14 August 2012 - 01:20 AM

Hi, is possible to use "layout (location = x)" for Uniform Block? I'm trying to make VAOs and UBOs independent on current Shader/Program.

glDrawElements

12 August 2012 - 02:17 AM

glDrawElements gives me an exception. All parameters are accessible. I have no idea what to do and where to start.

PARTNERS