Where to find Vulkan C++ specification? - c++

Where I can find C++ specification for Vulkan (same like the official C one on Khornos pages), describing the particular Vulkan api primitives and functions? Does it even exist (I was trying to find it with no success)?
Personaly I am using the C api even with C++ as I already got used to its style and it fits my needs perfectly (verbose, but you see everything), but I have to go through the code written by other people using C++ api. Usually Vulkan C++ api is just some syntactic sugar build upon the C api function calls, but sometimes digging through vulkan.hpp and trying to figure out what is going on is really annoying.
I am aware of this: https://github.com/KhronosGroup/Vulkan-Hpp

There is no "Vulkan C++ specification". There's a header file containing some functions and types that make using Vulkan more C++-friendly. But those are not part of any actual specification.
The mapping from "VulkanHpp" into regular C Vulkan is pretty obvious in most cases and can be deduced just from the nature of the APIs in question. vk::ImageCreateInfo means the same thing, with the same fields, as VkImageCreateInfo as defined by the Vulkan specification. The C++ wrapper is not trying to confuse users as to how it works.

Related

Why OpenGL does not overload its functions?

Recently, I've started working with OpenGL using C++.
I'm annoyed by the way of declaring Vertex or changing current Color
the glColor3f() and glVertex{2,3,4}{sdif}() methods.
now then, why OpenGL don't overload those functions.
for instance, it will be better to type glColor() and glVertex() and they will be recognized by the number of parameters and their type.
eventually, the code will look much better and easier to read, with the same results.
I hope there's a good reason to not overload similar functions.
Because OpenGL was originally designed with C as the primary language for its API, and C doesn't support function overloading.
However, quoting from Wikipedia:
Although the function definitions are superficially similar to those
of the C programming language, they are language-independent.
It is always possible for OpenGL to have a C++ interface that supports function overloading and all the good stuff, though AFAIK there aren't any specification on that, and are mostly supported only with C++ wrappers.

Can I use pure native C++ to write apps for windows 8 metro?

With native c++, I mean, not managed c++, not cli, not any special things from microsoft, I can:
1) get high performance
2) use existing c++ code library and engine
3) write cross platform code (for example, for ios and android)
it needn't be fully native c++, I can use managed code to do the ui things, like object-c in ios and java in android, but beside interface, can I use native c++ code?
I suggest you have a look at the presentation here: Using the Windows Runtime from C++ and especially at the comments from Herb Sutter. I quote:
Please answer this question: If I decide to write C++ GUI application
in Metro style am I forced to use all these proprietary ref, sealed,
^, Platform::String^ extensions for GUI components or not?
#Tomas: No, you are not forced to use them. We are providing two
supported ways:
1) These language extensions (C++/CX).
2) A C++ template library (WRL), see
Windows Kits\8.0\Include\winrt\wrl as Yannick mentioned. WRL is a C++
library-based solution sort of along the lines of ATL, which offers
what I think you're looking for -- template wrapper/convenience
classes and explicit smart pointers and such.
Yes you absolutely can, real native C++ is fully supported.
You do however mostly have to use the new WinRT libraries to do an user interface or system calls and although they are native code and fully callable from C++ directly the interface to them makes it very painful indeed to do so, as everything is a reference counted COM object and in addition it's not so easy to create instances of them as just calling "new" so you have to write a lot of ugly code to do so.
As the earlier answer said, microsoft provide two ways to help with this. One is via language extensions to c++ and the other is a c++ template library. Personally I consider both to be rather ugly for doing something as simple as calling an API but that's just me :)
But to answer your question, it's completely possible to write your application in real native c++. You won't need to use managed code at all for anything. But you'll probably want to use either the language extensions or the template library to make calling the API more easy.
Personally I'm hoping someone writes a wrapper for WinRT that exposes the most necessary functionality as a more usable c++ native library and then everyone can just use that from c++ instead...

Convert Lua code to C++ classes back in C++

I've seen similar posts but none that quite asked the question in the same way.
Basically, I've been playing with Shiva3d lately ( http://www.stonetrip.com/ ), which is a 3d engine. The coding inside the engine is in Lua, however, the actual product when exported from the IDE is C++ code. While the coding is restricted, it does a fair job at exporting function, variables and everything back in C++ code.
What I want to know is, can I create a base engine, where there would be a set of predefined class and then use Lua to extend/overload these base classes (by providing certain predefined required functions) and get that code back in C++ with the different Lua/C++ binding libraries that exist?
Have a look at SWIG http://www.swig.org/
It parses the C++ headers and creates binding for several languages (including Lua).
Although I really like SWIG, I fell in love with luabind, because you have more direct control. Additionally it provides a built-in object orientation system and you do not need an additional translator/compiler like swig.

Can I cross compile my AS3 code or Flex project to native C++?

I would like to tak emy existing AS3 or Flex project and compile it to run on native C++ code. Is there a way to do this? What sort of solutions exist? I do not want to change my AS3 code.
AS3 is a framework operating on prebuilt libraries you would have to replace somehow in your "translated" code. For example, what would you imagine the native code to do, when you do new Sprite()?
Haxe doesn't try to find a replacement. It takes different approach in that it lets you reuse bits of the code that would translate easily, but those that don't translate are marked as specific to certain environment. There is, however, an effort in Haxe to come up with API similar to those of Flash display list by using NME graphic engine.
Given your example with the iOS compiler - it, again, compiles against the existing library of native code that provides the functionality of display list, video and audio players and so on.
If you can convert it to Haxe (Haxe has extremely AS3 like syntax, only libraries and some language constructs differ) it should provide you with an option of compiling for "native". I've heard it even provides a C++ sourcecode or so I've been told by folks at IRC Haxe room. I could have been trolled for the code part, though he didn't seem like he was trolling...
I'ts not perfect and definitely lacks some more advanced capabilities but it's worth looking at probably.
No, because of
absense of dynamic features in C++ (you don't have Object and describeType equivalent there)
absense of Flash native types in C++ (String (std::string is not equivalent), display objects and many others)
absense of language features (event listeners, garbage collection)
absense of Flex framework equivalent in C++ (there are other good GUI frameworks in C++, but none looks like Flex - because of the reasons above.)
In short, it's much easier to write similar program in C++ (using Qt or whatever framework of comparable strength) than write convertor for that.

Looking for C++ implementation of OpenGL gears example

I have often seen the spinning gears OpenGL example ( I think originally done by SGI) but I today I have only been able to find C and Ruby implementations, can anyone point me to a c++ implementation?
What, in particular, would you be looking for in a C++ implementation that the C one doesn't provide? OpenGL is a C API, and thus a C demonstration is practical. A C++ implementation would call all the same functions in the same order and to the same effect, it would likely just wrap the implementation in an object. This doesn't really further one's understanding of the core API, and can possibly add a layer of obfuscation to those not familiar with some C++ styles and patterns.
If what you are really looking for is an example of initiating OpenGL wrapped in a C++ framework, I made a few of those a while back. You can find them here. Please note that I'm no longer actively maintaining the code or page, though.
If you want to mess around with OpenGL i strongly reccomend using OpenSceneGraph (OSG) since you can focus better on computer graphics aspects instead. It's using all the C++ magic and design patterns.