I'm appealing to people's psychic debugging skills:

I have an OpenGL app that uses shaders and attributes in uploaded VBOs exclusively.

It runs fine on the desktop (Linux with integrated Intel card).

It compiles for and runs on Chrome NaCL, which is OpenGLES 2.0. It does not draw anything, however (Vista, an ATI card).

The glClearColorf() and glClear() are working, and by picking a random clear colour I can get a nice flicker going so I know I've got the whole draw and flush cycle going fine in Chrome NaCL.

However, as I said, my program doesn't draw any of its content.

I have liberal glGetError() checks everywhere, and at first when porting they found lots of stuff such as needing to specify a float precision in shaders and not using full ints for element arrays and such. But now there are no errors reported anywhere.

I have printf debugging so I know my code-path is right and that everything I can think of is asserted.

The NaCL "tumbler" demo does run. Apart from their codebase being massively smaller, I can't spot what they are initializing that I aren't.

Anyone got any ideas what classic thing I've run into?

  • 1
    \$\begingroup\$ Unfortunately majority of opengl states end up with rendering nothing, so there's plenty of things that MIGHT be wrong.. since the demo app works, the rendering is working. Make sure you check the compile/link logs from your shaders. Then try to get minimal shaders working. That might give you a hint on what's still broken - stuff like wonky matrices etc. \$\endgroup\$ Commented Jan 9, 2012 at 7:49
  • 1
    \$\begingroup\$ Also note that gles is more strict about texture validity than desktop gl; if your textures don't have complete mipmap chains or you use wrong filter mode for certain textures, you end up with a black texture (iirc, desktop texture goes white). \$\endgroup\$ Commented Jan 9, 2012 at 10:09

2 Answers 2


I was not calling glViewport() in my resize handler; with SDL code, I wasn't needing to call it ever at all, as it defaults to the visible window (although in SDL you do need to reset it if you support resizing windows). In NaCL, you do need to initialize the properly.

Another gotcha was that in SDL, the default clear colour is seemingly black. In NaCL, its transparent (if you copy the standard examples, that set 8-bit alpha on the pp::Graphics3D when they initialise), and so the webpage will show through the NaCL component. A neat useful fact, but if you're not looking out for it it can appear as though its not clearing.


A general-purpose answer:

Find some example code. (I'm assuming NaCl OpenGL sample code exists.) Make sure it works.

Now replace your main() function with the example code. Again, make sure it works - if it doesn't, you've got a linking error.

Now gradually transform the example code back into your real main(). Add your non-OpenGL initialization code, test. Replace the example render code with your game's render loop, then test. Add your input loop, test. Replace the OpenGL init code with your init code, test. Eventually it'll break - that's when you can start diving deeper into that breakage to find out why.

Give me a positive example and a negative example, and I can eventually tell you what's wrong with the negative example, guaranteed.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .