10

Now that nacl is about to be on by default in chrome I'd like to try writing an opengl game. It seems that this is possible because there is a working quake port, but I can't find any documentation about this. Does anyone have a minimal example?

Bonus question: can I do any kind of networking from nacl? E.g. web sockets?

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262
Timmmm
  • 88,195
  • 71
  • 364
  • 509

4 Answers4

3

So far, it appears that NaCL (http://code.google.com/chrome/nativeclient/) doesn't allow you to do peer-to-peer networking, but by looking at the API you can start with this, which will enable you to work with URLS, and get a response:

http://code.google.com/chrome/nativeclient/docs/reference/pepperc/struct_p_p_b___u_r_l_loader.html

For 3D example you can look at the code here, which will at least show you what functions that were used.

http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/examples/gles2/

James Black
  • 41,583
  • 10
  • 86
  • 166
  • Excellent, exactly what I wanted. Thanks! – Timmmm Aug 16 '11 at 10:06
  • Except that sadly it doesn't work. I had to change a couple of `#include`'s, and change line 219 to `video_decoder_ = new pp::VideoDecoder_Dev(*this); video_decoder_->Initialize(&configs, *context_, pp::CompletionCallback());` after which it compiles. And I changed the width/height in the new-style HTML but it never displays anything. :-/ – Timmmm Aug 16 '11 at 10:24
  • Hmm actually it seems the quake port isn't using OpenGL. I guess it doesn't work at the moment. – Timmmm Aug 16 '11 at 13:03
  • You can also look at http://src.chromium.org/viewvc/chrome/trunk/src/gpu/, especially http://src.chromium.org/viewvc/chrome/trunk/src/gpu/demos/gles2_book/ . My point in showing this was that some of the examples may be of use to you to help you find other resources. – James Black Aug 16 '11 at 20:10
  • Looks like you can use websockets: http://code.google.com/p/chromium/issues/detail?id=87310 is that enough? – rogerdpack Dec 27 '12 at 18:18
3

I was trying to find the answer for this one a few days ago.

Here is a working NaCl OpenGL cube webpage

Here is the code for the sample you can compile "out of the box" like the other NaCl SDK samples:

BTW: I renamed the .nexe files to .n - to stop an annoying Chrome warning about the files.

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
1

Here is an example of Ogre3D sample browser:

https://chrome.google.com/webstore/detail/ocpoapiejnpokdojkgjhglijajghikla

Raman Sharma
  • 4,551
  • 4
  • 34
  • 63
0

As @sometimes-a-developer mentioned Ogre3D was already adapted to be used with NaCl. The only problem is that there is no easy way to build it. You can check yourself here: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=66394

I'm trying to sort out that things by making Ogre3D part of naclports: https://github.com/pkukielka/naclports-ogre3d I'm also working on basic example of how to use ogre with NaCl: https://github.com/pkukielka/ogre3d-nacl-template

Port it finished and example is in progress (will be done soon). With this 2 things it should be enough to run 2-3 commands to have Ogre3D with NaCl up and running.

Piotr Kukielka
  • 3,792
  • 3
  • 32
  • 40