Skip to content

Feature: ofCamera should be used for internal of view #1502

ofTheo opened this Issue Aug 22, 2012 · 5 comments

6 participants

ofTheo commented Aug 22, 2012

I thought I had posted this already.
It would be great if we could have ofCamera do the camera setup in a default OF app.

Right now the code is duplicated.

Also it could allow the user could do something like:

ofCameraRef cam = ofGetCameraRef();
ref.dolly(-200, 0);

It would also allow for swapping out the current view with a different one.

ofSetCamera( newCam );


ofSetCamera( newEasyCam );

This is actually not really the api I'm proposing.
Just the overall change I think should be made.

Relates issues:

One other thing that is more of a bigger question is can we make OF more object orientated?

ie instead of:
ofSetCamera( ofCamera cam );

ofGetWindow(0).getContext().setCamera( cam );

Anyway I think that is for a separate GH issue - but I mention it as OF's global methods list is growing quite quickly and it might be time again to look at namespaces or moving some of the things in a more object orientated direction.

openFrameworks member

yeah I agree, stronger object orientation is definitely a separate issue, also something that should go on the list!


stronger OO totally shakes up the API
oF is really great at being procedural. going OO doesn't happen well in stages.
For example, ofViewport should probably be a class. A viewport is a thing not an action.
You might for instance, pop viewports onto a context, and set a camera for each
And pop drawable objects onto each viewport.


I like theo's idea, yet this looks very ugly and cryptic
ofGetWindow(0).getContext().setCamera( cam );

vs this

ofSetCamera( ofCamera cam );

even though I understand the idea behind it.

Couldn't it be much more like
ofGetWindow(0).setCamera( cam );

just having the getContext() there seems obstrusive.

I completely agree with elliot's idea about ofViewport.

I did something more or less like what elliot describes and it becomes really useful. I can clean it and shape into something more usable (I think there might be a lot of function names in spanish ;P ). Maybe start with an addon?

But also, shouldn't this be related to all the windowing system?
Are there any ideas about how to approach a new windowing system?
ofxFenster works really nicely but I like having NSWindower's cocoa windows and menus in osx.
Couldn't there be a mix between.
I guess that this should go in a different issue :)



hey @elliotwoods or @ofTheo would you be interested in implementing this feature some time soon? theo, i know you're a proponent, and elliot i know you would have a good feeling for the best way to do it... and you're the 3d section leader... :)

openFrameworks member
bakercp commented Dec 29, 2012

perhaps we could take a stab at integrating this on the GLFW @underdoeg branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.