How can I draw a Sphere with SharpDX *3.0*? - sharpdx

The SharpDX toolkit has been abandoned for 3.0 SharpDX :(
Unfortunately, we need/are using this for a current Windows 10 project.
What we need to do is create a Sphere object as a surface so we can project on to it. Can anybody lead me to some things (or simply provide said things) that might help me out?
Thanks!

I can help you with the toolkit side of things, I'm using this atm for my terrain color map building I'm not sure how it will go if you use it every frame for UI type stuff because the guy that converted it to sharpdx 3 used pinvoke instead of the native fixed call.
https://github.com/tomba/Toolkit
just download as zip, load into VS and remove all the test\projects that fail to load then just build and add a ref to you project like normal.

Related

Delphi DX11 Direct3D Vertex and Pixel Shader Issues

I'm attempting to translate some C++ DX11 Direct3d height-map code into Delphi. I'm at at a stage where I have almost the entire code translated across without any compile errors or run-time errors however I cannot for the life of me get anything to render on-screen - which I believe may be a vertex/pixel shader issue.
The code I'm translating across is here:
http://www.rastertek.com/tertut02.html
And I'm using the JSB DirectX11 interface libraries from here:
http://www.jsbmedical.co.uk/DirectXForDelphi/
I know that the Direct3D subsystem is working correctly as I am able to alter the color of the background of the render surface however, I just do not get any polygons rendered on the display.
There is quite a lot of code which I'm unable to upload here so for convenience, here's a copy of my source (without any object files/binaries)
https://www.dropbox.com/s/r90jbl6vz9gb3s7/Delphi%20Height%20Map.zip?dl=0
Unfortunately, there doesn't appear to be many Delphi DX11 or D3D examples on the internet so I have nothing to benchmark the code against.
I'd be eternally grateful if anyone could offer any pointers as to what may be the issue. Like I say, the code compiles and runs without any errors but just nothing is rendered.
Thanks in advance,
Kevin
You can look here on how to do basic rendering with D3D11 using Delphi - https://github.com/AntonAngeloff/DX11_Examples
These examples use another headers translations, though.

How to create and immediately be able to use spritefonts during runtime?

I'd like to know if it is possible to select a typeface, font size and be able to use it right away during runtime in an XNA application.
If it isn't possible using built-in runtime methods, maybe it's easier (or better, or faster) to do it using some automation software (like autoit) to create spritefont file in the background, and be able to use it afterwards in an XNA app without restarting the app?
I'm going to use this mainly on my own computer for testing and picking fonts, so I'm okay if it requires full VS installation along with XNA framework and any other stuff.
Easy put, it can be done, but you have to use WinForms, link to tutorial in order to load spritefonts. You could do it simpler, by making a couple of spritefonts before you do anything (or create spritefonts for every font you have and add them to the content). This is so, because of how XNA handles spritefonts. As you've seen, SpriteFonts are basically an xml file. This is not how the final binaries are. The final binaries are images containing every character in the font you selected at that size. That way, the gamer doesn't have to have the font installed in order to play your game, and therefore you can do some awesome stuff with fonts and the user can't use that font (unless he rips it).
I have not yet found a tutorial for winforms and spritefonts, but I suppose that the model version needs only a little modification for it to work with spritefonts.

Java: How to open a library?

I want to open libraries, because currently I want to see the algorithms used for drawing, modify them and implement them in my program. For example: I have tried to create an algorithm on my own for lines. But I failed. And even if I had succeeded, I fear that it might not give the same result as the algorithm in the libraries. And I don't want this to happen. That's why I want to copy the algorithms used for the methods in libraries. And I really hope that this will help me create the application I'm currently working on and with other applications in the future.
I tried to open the libraries with a code editor. But I had troubles finding the libraries- I don't really know where are they placed nor in what files are their codes stored.
How to open a Java library? Or is there a place in the Internet where the code is uploaded?
It sounds like what you want is to get inside the standard Java libraries (so you can see the code for methods like Graphics.drawLine()).
You can download the source files from the same place you got the JDK, if you are on Windows or Linux. For the Mac, see this question. You can even set up Eclipse so that you can debug into that source as if it were your own code.
However, you will probably not find line-drawing code in Java in these libraries - the Graphics implementation will almost certainly use native methods, and may just call existing methods in the OS.
If you are specifically looking for line drawing algorithms, another option would be to look at the Wikipedia page for the Bresenham (aliased) or Wu (antialiased) algorithm.
Edit:
The part of a Graphics2D call that actually puts pixels on the screen is probably inside a system call and therefore the source would not be available.
A java vector graphics library like Batik might have source for some of these algorithms, but probably relies on the Graphics2D calls for most of them. So, you might look for a comprehensive vector graphics library written in a language other than Java, where those graphics calls do not already exist by default.
Alternately, checking the table of contents for a computer graphics book might point you at a variety of algorithms that you could look up on Wikipedia.
For any given library:
Make sure to obey all licenses when using another's code
If you are referring to the Java SDK source code, you can find it here: http://grepcode.com/
If the project is open source, you can usually just get the source from the project website. No problem, though make sure to obey their license.
If the project is NOT open source, well, then you're in a pickle licensing wise, so I do NOT endorse this, however, you would need to use a Java Decompiler such as JD-Gui
As far as what drawing algorithms to use, there are so many different ones (obviously, people have been trying to draw quickly for many many years), your best bet is to figure out exactly what you need to do and then search for that specific need separately. There isn't really a good repository of ALL of them, except maybe wikipedia.
If you are using the libraries they are on your classpath. Check out how to figure out your classpath in whichever IDE you are using and you can find the JARs you depend on. If they are packaged with sources all you need to do it unjar them and look at the sources.
If you don't have access to the sources you can get the code using a Java Decompiler.
If you are trying to look at a standard Java library, see the other answers about getting the source to the JDK.
If you are interested in an open source library (such as something maintained by the Apache project), look on the site of the project for a 'source jar' which you can open with a standard zip utility.
If the library you want is not open source or you cannot find the source for it, you can try to decompile it. If you are using Eclipse, try this decompiler.

Dart HTML5 Canvas Library?

I wanted to know if there were a Canvas external library for DART like Fabric.js ?
If it doesn't exist is there a project to make one ? Cause I'm thinking of starting this project, but I would prefer joining a existing project on GIT.
Or maybe there is things integrated in DART that I don't know ?
I've not worked with Fabric.js, but after taking a look at the website, I'd point you to the projects listed below. Neither project is exactly what you are looking for, but should give you a starting point.
2D (Flash object model) - The project changed to StageXL
https://github.com/bp74/StageXL
WebGL
https://github.com/johnmccutchan/spectre
I don't know of any serious Canvas abstraction libs for Dart but maybe these two projects could provide a good inspiration foundation to create one.
Drag & Draw approach
Animation approach

How can I do a form with an image spinning in Delphi?

Like those we see in website. And where do I get the images?
Go to ajaxload to generate an image. Then find a delphi gif image component. Try here for a start.
The "spinning images" are usually animated GIFs. Do a google search for the phrase in quotes to learn about them, and you should also find software that will help you create them as well. Support for them has been included in Delphi for a couple of years now.
If animated GIFs aren't good enough, you can look into AVI files. They're what Windows uses to show files being copied, folders being scanned, and other things. TAnimate is the Delphi component that supports them.
I do suggest running your "work" in a separate thread. AsyncCalls is a good library which works well for helping you get there easily. Tight loops or blocking calls can cause your animation to look jumpy or stop completely.

Resources