Comments (6)
You can access all the methods through ofVec3f()
variable before converting it to glm::vec3()
.
So I'd suggest always define variables in ofVec3f()
type and only covert them to glm::vec3()
when needed.
Like the following example:
ofelia f;
local v = ofVec3f(3, 4, 1);
print(v:length());
local mesh = ofMesh();
mesh:addVertex(v:vec3());
local v2 = ofVec3f(mesh:getVertex(0));
print(v2:length());
I don't think it is currently possible to directly initialize glm::vec3()
by doing something like local v = glm.vec3(0, 0, 0)
in Ofelia. This could be a bug or recently supported feature of ofxLua. I will try to update ofxLua used in Ofelia soon and see if glm
can be used directly.
from ofelia.
mesh:addColor()
accepts ofFloatColor()
instead of ofColor()
which uses float r,g,b values between 0 and 1.
You can check the ofelia/examples/3d/coloredCube
example to see how it can be used.
from ofelia.
Hi, you should convert ofVec3f()
to glm::vec3()
by appending :vec3()
to ofVec3f()
as it says here: https://github.com/danomatika/ofxLua#glm
So your code should be
mesh:addVertex(ofVec3f(0,0,0):vec3());
from ofelia.
@cuinjune, thank you! It works for addVertex, but what about color? How to convert ofColor_< unsigned char >
to *|ofColor_< float >
? And is there an approach to get a list of all methods of an object?
from ofelia.
Where I can find information about mathematical operations with glm objects? When I try call any methods of glm::vec3()
I got errors:
- ofelia: [string "package.preload['__.x25eb0c0.c'] = nil packag..."]:4: attempt to index a userdata value (local 'v')
I mean acces to vector components or length()
, distance()
, dot()
, cross()
etc...
UPD:
Found approch to doing it. I need wrap glm::vec3
back to ofVec3f
type. And there available all needed methods.
like in this example:
local v1 = ofVec3f(mesh:getVertex(0));
local v2 = ofVec3f(mesh:getVertex(1));
print(v1:distance(v2));
But still actual question about getting list of object methods )
from ofelia.
@cuinjune, thank you very much! I have a number of questions and suggestions on how to improve the ofelia. Can we chat in person on Facebook or Telegram so as not to clog up the thread?
telegram
facebook
from ofelia.
Related Issues (20)
- Multimonitor fullscreen? HOT 2
- couldn't create ofWindow error
- GLpointSize HOT 3
- ofxiOSGetDocumentsDirectory() not working
- ofxOfelia v4.0.0 and OF 0.11.2 do work with the new ofxLua version 1.4.4 HOT 5
- Ofelia issues with pd-0.52 under OSX and Windows HOT 10
- Ofelia freezes PD 0.52.0test2 HOT 2
- Emscripten and FreeImage lib
- EXC_BAD_ACCESS when iterating through verticies in ofMesh
- Ofelia doesn't work with Pd 0.52-1 on Windows 11 HOT 2
- Build instructions for linux are vague and makefiles seem to be out of date
- ofBackgroundGradient crash after screen rebuilt
- Optionnal -k flag to keep contents make crash on start
- Is it possible to trigger and change the input values to steer the graphics from pure data? HOT 1
- Issue with Ofelia and M1: ofSetBackgroundAuto(false) & "Failed to find service port for display"
- M1 Build ld: symbol(s) not found for architecture arm64 HOT 1
- M1 Build error: use of undeclared identifier 'PD_SYS_LOCK' PD_SYS_LOCK()
- Problem with class creation HOT 2
- I updated Ofelia libs OfxPd (PD 0.52-2) and OfxLua (1.4.4) HOT 23
- 'undefined symbol: _ZNK5boost10filesystem4path9extensionEv' (Linux) and development status of ofelia HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ofelia.