The problem is: When I let this code run the quads are completely white!

The strange thing: When I comment in the outcommented line (glTexImage2D), the quads are textured! It seems like as if the texture I load into the VRAM in function init() is disappeared and I have to upload it every frame.

2. Why are you doing this: texObj.data = data ? Unless it's for a very specific reason (getting heightmap values on the CPU side, as well as the GPU), it's just wasting memory. You can skip everything involving copying the data from the image (the calloc + memcpy), and instead just pass glImage.bits() to glTexImage2D directly.

3. You might find that using glPushMatrix / glPopMatrix surrounding the scaling and drawing of the quad will be useful (stops the transforms leaking into other draw calls).

4. glTranslated(0.0,0.0,0.0); << this is pointless.

5. enabling / disabling texturing and face culling constantly is a bit silly. You'd be better off moving those outside so you can do:

6. glFrontFace( GL_CCW ); This is something you shouldn't need to be calling everytime you draw a single quad. Just once on start up will do fine (and then keep everything with the same winding order).

The problem is: When I let this code run the quads are completely white!

Check the values of tex.texID. Are they the same two values used when generating the texture?

The strange thing: When I comment in the outcommented line (glTexImage2D), the quads are textured! It seems like as if the texture I load into the VRAM in function init() is disappeared and I have to upload it every frame.

Which makes me think that you have either an invalid texture object, or that it's changing it's id somehow. You are initializing the textures AFTER you create the window right? (otherwise the gl context would be invalid, and the texture creation will fail).

Thanks RobTheBloke for your detailed help! You pushed me in the right direction:)

The problem was: When I uploaded the images with glTexImage2D I had no OpenGL context. I find it very strange that glError() did not tell any error though...

One last question: How is it possible NOT to have a valid context? I mean after I create a context and "activate" it by calling wglMakeCurrent (), isn't the context now active forever? In other words: I thought after calling wglMakeCurrent() I can use OpenGL calls in my code in every function I want. Did I miss something?

I think the main case where you'd be unable to use a context is due to multithreading. An OpenGL context cannot be active on multiple threads, so in the case where you wanted to call OpenGL functions from different threads, you'd need to either create more than one context and have them share data (with wglShareLists), or have each thread sync and make the context current / not current as needed.