Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2008
Offline Last Active Yesterday, 07:19 PM

#5263528 Render GUI elements with projection matrix

Posted by on 25 November 2015 - 02:59 AM

That depends on what you want to do, usually you have an overlay 2D ui to do things like error message boxes or HUD elements but these are 2D ui and are a different scene from the 3D ui one. And they just use normal ortho projection rendering.


Offcourse you can embed rendertargets into the 3D scene to render another UI scene to that, but even for that you dont need to know things about pixels for positioning the elements.

#5263526 Visual Studio Community need to login!

Posted by on 25 November 2015 - 02:56 AM

The login part has its advantages. 


Vs2015 will save various preferences to your profile, and if you reinstall they'll all be fetched from "the cloud" for you.


A worthwhile sacrifice for the service as setting up programs again how I like them is an annoying chore that I'd rather avoid...


There are other things linked to it as well, like your developer status for store apps and beta apis that you can use.

#5263432 Render GUI elements with projection matrix

Posted by on 24 November 2015 - 11:56 AM

Thanks to all for your answers. 


What do you think about using PerspectiveOffCenterLH matrix for this?

Seems it project DirectX units directly to pixels and position correspondingly. Using this matrix 0.0 will be at the top left corner of the window without any additional manipulations.

Step away from the pixel idea for 3D ui pixels dont really matter, the scene is authored in 3D space and its coordinate system. Think in camera composition instead, moving the camera closer to an object will make it appear bigger on screen.

#5263321 Render GUI elements with projection matrix

Posted by on 23 November 2015 - 02:22 PM

I mean that I want to draw controls using true depth feeling, which could be made only with projection matrix. With ortho I need to scale objects manually if I want make them smaller when they are far from the camera.

You will want to just do normal 3D rendering and use a camera to view the menu through. Use this camera idea to frame the UI too it makes it a lot easier to deal with.


In a 3D ui you dont have to care about the 0,0,0 mapping on to the 0,0 corner, this is what the frameing with a camera is for.


If you look at the DiRT and GRID games they all have a 3D ui, and for ease of development we never supported mouse input all input is either keyboard arrows and enter or controller. Doing the unprojection is not that hard but the system we had to create these UIs made that a lot harder, the update side of the UI had no idea of where the rendering of the UI was happening in space. Which allowed for a lot of flexibility in setting up scenes and implementing the behaviour of the screens at the cost of not having mouse input though.

#5262753 No idea about this warning in VS2015

Posted by on 19 November 2015 - 10:25 AM

By upgrading to the latest SDK

#5262432 AS3. Inventory function can't be called in a Scene

Posted by on 17 November 2015 - 11:04 AM

You are trying to execute a function of a none existing object in as. In Flash CC you can start a debug session with ctrl+shift+enter, when this error occurs it should stop at that line of the code, either in the AS file or on the actions tab for a particular frame.

#5261872 [c++ | asm x64] I think I call a function in the wrong way

Posted by on 13 November 2015 - 02:52 AM

Eeh, I must be sounding like a spoiled asshole dry.png I won't argue if you think that of me.
But I'm not that bad a person. Really.

And I appreciate the help.

I'm just bitter because I'm being halted by yet another problem that's only the last in a long streak you haven't seen me deal with. Only, this time it involves assembly, a subject I never delved in.
Could this be solved it'd be the very last brick to complete the wall. Which makes it even more frustrating a problem, 'cause I'm spending several hours on it instead of moving on the other modules in this project.

I'll read the link posted by Nypyren (<-- thanks for it, man), and then, dunno, we'll see...

What are you really trying to achieve, maybe if you described more of your problem in general terms we might actually be able to give you a solution. And that solution might not even need asm to work.

#5261843 [c++ | asm x64] I think I call a function in the wrong way

Posted by on 12 November 2015 - 05:39 PM


The ABI for both the 32-bit and 64-bit code is well documented. There are several large PDFs about it, you need to read them and have a solid understanding of what they are and how they work for all the different calling conventions and parameter types, an understanding of what must be saved and what is invalidated, and know how to convert from one to the other.

So you're saying that I should go read a couple tomes, learn how to do proper assembly, implying that I shouldn't be asking for help in a forum.

Honestly, that wasn't nice. At all.


[...] On the other hand, the 32-bit cdecl calling convention will preserve EBX, EBP, EDI, ESI, ESP, CS, and DS. While the 32-bit code shouldn't be touching the Rxx registers you need to know that they might, so you need to preserve them. Since the memory addresses in 64-bit code may not exist in the 32-bit address space you need to ensure proper virtualization. You don't do either.

You talk to me as if I know this stuff already. Don't you realize that this is the same mistake made by every one of those that write the tutorials on assembly? Those very same tutorials that I don't understand -- because they assume I'm familiar with the subject _already_? If that was the case why would I be reading a tutorial?
And the same goes for the notes on the x64 ABI -- And by the way, by mere luck I know what A.B.I. stands for. But you just threw the acronim in the discussion, assuming that I knew it _already_. See? the same mistake


@ Rattrap:

I understand now. Makes sense.

But still: whatever I write, doesn't work. It crashes invariably. I'm noticing a misalignment with the arguments passed to the function that's crashing. Instead of a pointer to a pointer I'm seeing the address of a local function. And where should be a small integer value I'm seeing what might be a portion of an address. It's as if things were offset to the left or right altogether.


You are trying to do something in asm that is a fairly advanced affair, if you dont understand asm well enough I would not even start with DLL loading and stick with getting the hang of asm first. Visual Studio can show you what asm is generated for C/C++ code when you are on a breakpoint and tell it to show you the disassembly. It should look like this: L3ral.png


Assembly is not a topic you should jump in lightly and x86 and x64 is not the easiest instruction set to get to know. You should start learning asm with a simple board like an arduino or a Rasberry pi, this chips are simple enough to easily understand what is going on on them. From there moving to x86 and x64 is easier, because you understand the basics of asm by that point.


There are some serious tricks going on in some asm code like moving to only the ah or al register and then cmp on the next line with eax or rax, which require that you know things about the architecture of the chips involved. For example: al/ah, ax, eax and rax all refer to the same register for example but with different bit sizes and this is all legacy stuff coming from the shifts from 8 bits -> 16bits -> 32bits -> 64 bits. In x64 you will hardly see any x87 or FPU instructions any more these are almost always replaced by SSE2 instructions. I am surpised that link nypren provided didnt mention the LEA instruction because next to the most common once that lists.

#5260924 char[32] as function parameter

Posted by on 07 November 2015 - 02:40 PM

The syntax for array passing is crazy in C++ but this will do allow you to do this:

template <size_t charCount>
void stringCopy(char (&output)[charCount], const char* source)

I highly recommend you use a template on the array parameter here because this function now works with any sized arrays.


#5258020 Confusion with smart pointers

Posted by on 19 October 2015 - 06:03 PM

You would get access violations if you were trying to access member variables in those functions on very low address. Like access violation at 0x00000008 for example, usually when seeing these low address values in access violations it indicates that your object access has been cleared. Because members are usually accessed by adding the field offset to the object memory address.

#5256990 Migrated from VC++ 2008 Express to Visual Studio 2015: Now getting linking er...

Posted by on 13 October 2015 - 01:32 AM

Or if you have the code for that library rebuild it with VS2015

#5256818 Hash on gpu?

Posted by on 12 October 2015 - 02:57 AM

The question I am asking myself is why do you want to do this on the GPU. If its just to have a resource name changed in a hash the CPU will do fine for that.

#5255993 Thoughts on the Boost.Build system? (as opposed to CMake?)

Posted by on 07 October 2015 - 05:57 AM

For C++ on Windows, I've been preferring development in Sublime Text, rather than Visual Studio. It's more lightweight, there's less magic going on and I've got it configured the way I like. And I really hate VC++'s filtered folder project system. I just want to see my source directory and not have to screw around with the project file every time I want to add a child folder. Also, as someone from a non-C++ background, I feel I am learning more by running my own build script (just a custom PowerShell script at the moment) and having it run CL.exe. CMake is all well and good, but my project is built around a large number of plugins which each have to be built separately, and... well I guess the way CMake clutters up my folders with a million files just irks me a bit. That, and I've read a number of stories from other projects where the developers were complaining about CMake problems that made their lives harder rather than easier on Linux. I like things to be simple and clean.


Even so, I know that maintaining your own set of build scripts can get complicated and be a pain to maintain, particularly when you want to target the other major OS's as well. CMake's not the only show in town. What do you guys think about Boost's build system? I built Boost for the first time a few weeks ago and found the build process to be very clean and straightforward. Still, CMake seems to be what the majority of dev teams gravitate towards, so I'd like to get the opinions of those more experienced than myself with cross-platform C and C++ development. If you know of something else really solid as well, I'd be interested in that as well.


You do know that you can switch Visual Studios solution explorer view to show you the real files underneath right? Once you set this and saved the solution file it will open in this view. The option is called "show all" and is in the top bar of the solution explorer window, this change the option in the add menu from "New Filter" to "New Folder".

#5255801 What's the best system on which to learn ASM?

Posted by on 06 October 2015 - 07:05 AM

I much preferred the 68k style of assembly over x86 just feels cleaner and nicer to work with but as Eric said, you have an x86/x64 machine so easier to play with.


That said in the modern world it is far harder to get to the metal than it was when I played with assembly so getting an old machine emulator and using that would be a good in.


For a gentile introduction in playing at a low level you could explore the old nerd classic that is http://www.corewars.org/ is is a pseudo assembly language where two programs get loaded into an "address space" and have to locate and destroy the other before they get killed smile.png


Its not that hard to kick an asm function even from x64 code, the only thing that has gotten hard is that the C++ compiler no longer allows for inline ASM.

Is a good series on getting started with x64 asm in VS2010, he shows you how to call an asm function and then moves on to explaining what all the instructions do.


I learned ASM on a 8088 like board with MASM as the compiler this looked so much like x86 asm that moving to PC was only getting used to the new register names like EAX and stuff.

The other thing you can do is write a simple function in C/C++ and see what the compiler transforms that into on PC in a debug build. You will want to do this in a debug build because in that case the compiler will actual transform all of your code in to ASM.

#5255116 WIN32 or WIN64

Posted by on 02 October 2015 - 05:37 AM


Are you running out of memory/resources while you target x86? If not then the question becomes "Is it worth it?" smile.png


That was the initial reason, yes


The market is now dominated by x64 machines, only 12% of the windows OS installbase in the steam hardware survey is running a 32bit version of windows on mac and linux there is no more 32bit version in the survey. Another reason to add x64 support is so you find those nasty bugs in your code where you are assuming that a pointer is always of size 4, these kinds of constructs in your code are bad.


One of the other reasons could also be that all 64bit cpus support SSE2 so that SIMD instructions in release builds are enabled by default, this might give you a performance increase for free.