i started programming with SDL and OpenGL!
My first project was a simple rotating colored triangle. After that i tried a 2nd triangle, but this time textured!
After around 1 hour playing around with the byte-order (ARGB, RGBA etc.) it worked.
But now my 1st (still simple colored) triangle gets pretty dark.
i could figure out which functions causing this problem, but first my triangle code:
glRotatef(theta, 0.f, 0.f, 1.f); glColor3f(1.f, 1.f, 1.f); glBegin(GL_TRIANGLES); glColor3f(1.f, 0.f, 0.f); glVertex3f(0.f, 1.f, 0.5f); glColor3f(0.f, 1.f, 0.f); glVertex3f(0.87f, -0.5f, 0.5f); glColor3f(0.f, 0.f, 1.f); glVertex3f(-0.87f, -0.5f, 0.5f); glEnd();
and these are the functions which cause the problem:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, surface->w, surface->h, 0, textureFormat, GL_UNSIGNED_BYTE, surface->pixels);
As soon as one of them gets commented out, my 1st simple triangle works again...
For simplicity i turned of the render part of the 2nd textured triangle...
How it should be:
How it actually is (barely visible):
So i'm asking you guys, what am i doing wrong? o_o