Which API_s uses Unity, Direct3D or OpenGL?
And if I’ll write Constructive solid geometry operations in OpenGL, will be I able to use it in Unity? Transfer meshes from unity to my code, do operations and return to Unity again or something like that?
On Mac it can only use OpenGL, on windows it uses DirectX if available otherwise OpenGL.
Not sure about the CSG, I guess it depends what you mean, at the triangle/mesh level or in realtime using a stencil buffer?
I’m fairly certain Unity uses Direct3D on Windows and OpenGL (in one form or another) on OS X and iPhone. Perhaps someone else can confirm.
However, it shouldn’t matter as far as CSG goes. The rendering backend is completely abstracted away as far as the scripting interface is concerned, so I can’t think of a reason it would matter as far as your CSG code goes whether Direct3D or OpenGL is being used.
Also, there’s really no such thing as ‘constructive solid geometry operations in OpenGL’. Mesh data is mesh data, irrespective of what graphics API is being used to render it, so any relationship between CSG code and any particular graphics API will most likely be more or less incidental.
I have some tutorials how to use brushes in OpenGL to do CSG operations. I think there will be another syntax in DirectX
I want to do in both level
You might have some CSG tutorials that are OpenGL-based (that is, they use OpenGL for rendering), but I doubt the CSG operations themselves involve OpenGL in any way.
Even if they do (say, through some unusual shader-based technique or plane clipping or something like that), it’s purely incidental; the algorithms themselves are general and are not tied in any way to any particular library or API.
Anyway, since for most purposes you don’t have to know or care which graphics API is being used when using Unity, I’m not sure why it matters whether OpenGL or DirectX is being used for rendering. I’m still not sure what you’re asking exactly, but what renderer is used should really have no bearing on any CSG code you might incorporate into your project. Mesh manipulation typically goes through the ‘Mesh’ class interface, which is API-agnostic; you just perform whatever operations you want, and then assign the mesh data to the ‘Mesh’ object.
If you need further help, perhaps you could explain your question in more detail.
You might have some CSG tutorials that are OpenGL-based (that is, they use OpenGL for rendering), but I doubt the CSG operations themselves involve OpenGL in any way.
If you need further help, perhaps you could explain your question in more detail.
I understand that it hasn’t matter, but I have tutorials written in OpenGL and I’m wandering how can I integrate it with unity
I understand that it hasn’t matter, but I have tutorials written in OpenGL and I’m wandering how can I integrate it with unity
First of all, a tutorial can’t be ‘written in’ OpenGL. OpenGL is just a graphics API. A tutorial could make use of OpenGL for graphics, but OpenGL isn’t an actual language that you write code in.
Anyway, that might just be a language/terminology issue, but I thought I’d clarify just in case it’s causing confusion.
As for your question, I can think of two options off the top of my head:
-
Port the code (if necessary) to one of Unity’s supported scripting languages, and work directly with the mesh data via the ‘Mesh’ class interface.
-
Port the code (if necessary) to C++, and implement the functionality as a C++ plugin. (I’m assuming this could be done, although I haven’t worked with Unity’s plugin system myself.)
Thanks for explanation.
Have you worked in OpenGL or DirectX?
Thanks for explanation.
Have you worked in OpenGL or DirectX?
Sure, I’m comfortable with both APIs (which is fairly common these days).