ofNode GL 2.x compatibility?

Hi all,

I want to do some basic 3D object and light movements. I did zero 3D stuff yet and really don’t know how to address this the best way. ofNode seems to be a good starting point. Now here is my question: What’s the reason that the ofNode example is using GL 3.2? It seems like the light is not working with a 2.x version (which I have to use right now). Is there a possibility to use ofNode and light sources with GL 2.x?


as far as I know, ofNode works also with GL 2.x. What did you tried? if you share your code i can try to help :wink: I’ve worked a bit recently with ofNode.

There is this example in examples/3d/ofNodeExample. If I comment out the line about the GL version in main.cpp, the light of the scene is gone.

You’re right. If we don’t set up the window as it is in the example, but using the “traditional way” like this:

int main( ){
    ofRunApp(new ofApp());

we have to call light.enable(); in the setup method. I will open a PR and add it to the example.

Yes that’s it, thank you!

Another noob question: Can this enable() function be used to avoid the limitation of 8 lights? So if you have more than 8 lights you could enable only the 8 lights that are next to the camera for example or how would one manage that?

As far as I know, ofNode is not strictly concerned about which version of OpenGL you are using. ofNode it’s just a class that contains information about the position of a point relative to the object itself, to a parent object(if there is one) and relative to the world space, with a handful of methods to perform rotations and movements.

Regarding the 8 lights limit. You can use more than 8 lights, but in order to do that you have to use the “programmable pipeline”, instead the “fixed pipeline”. The ofNodeExample it is using the programmable pipeline. With the programmable pipeline, you can, theoretically, define as many lights as you want, and then you have to deal with the lights in the shaders. You can pass lights to the shaders using an array. http://pyopengl.sourceforge.net/context/tutorials/shader_7.html

It can be very complicated if you have no experience with openGL, i would start learning the concept of the programmable pipeline first and then having a look into shaders (this is a good article http://openframeworks.cc/ofBook/chapters/shaders.html). This is the link to the OF blog post with the announcement of the release 0.9, it contains some info about the programmable pipeline. http://blog.openframeworks.cc/post/133400454159/openframeworks-090-opengl-45

Alright, I’ll do that, thank you for all the tips :slight_smile: