Jump to content

  • Log In with Google      Sign In   
  • Create Account


Somone else

Member Since 24 May 2012
Offline Last Active Dec 04 2012 07:07 AM

Posts I've Made

In Topic: glTexImage2D does nothing

30 May 2012 - 09:18 AM

Are you sure glGetError doesn't detect any problems?
Also, what is your GL version?

This time, errors did appear.
I traced (due to the lack of a better word) it back to the SDL OpenGL configuration: I apparently didn't enable SDL_GL_MULTISAMPLEBUFFERS.

~Solved

In Topic: glTexImage2D does nothing

28 May 2012 - 03:03 PM

Turns out I only fixed the code for "power of 2"-textures.
My graphics card does support GL_ARB_texture_non_power_of_two, and in my other project it worked absolutely fine.

In Topic: glTexImage2D does nothing

27 May 2012 - 05:07 AM

After fiddling around with the code for a bit, it appears that I've solved the problem.
I don't know what caused it though.

In Topic: glTexImage2D does nothing

24 May 2012 - 02:25 PM

wglGetCurrentContext() doesn't return NULL. I don't know if there is more to check than that.

In Topic: glTexImage2D does nothing

24 May 2012 - 09:05 AM

Here you go:
Clear();

SDL_Surface *Surf = IMG_Load(File.c_str());

if(!Surf) return false;

GLenum Mode = GL_RGB;
if(Surf->format->BytesPerPixel == 4){
    Mode = GL_RGBA;
}

Width = Surf->w;
Height = Surf->h;

glGenTextures(1,&Tex);
glBindTexture(GL_TEXTURE_2D,Tex);

glTexImage2D(GL_TEXTURE_2D,0,Mode,Width,Height,0,Mode,GL_UNSIGNED_BYTE,Surf->pixels);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

int Min,Mag;

glGetTexParameteriv(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,&Min);
glGetTexParameteriv(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,&Mag);

SDL_FreeSurface(Surf);

glBindTexture(GL_TEXTURE_2D,0);

PARTNERS