Could use some help real quick. I am trying to get a quad to move using pixels as units, but it doesn't work once I scale the quad. If I keep the scale at 1, 1, 1 then it moves 1 pixel when I translate it by Vector3f(1, 0, 0). But when I scale it to 16, moving it by one unit moves it by 16 pixels. How do I fix this? Here is what I am using for my orthographic projection.
createOrthographicMatrix(0, 640, 0, 360, near_plane, far_plane);
[QUOTE=Map in a box;41100288]Trying to build my test OS, but it's failing:
[code]
bin/boot.o: In function `_start':
src/boot.asm:(.text+0x6): undefined reference to `kernel_main'
[/code]
Copypasta'd from the osdev tutorials.
Boot.asm calls
[code]
extern kernel_main
call kernel_main
[/code]
and kernel.c has
[code]
void kernel_main()
{
terminal_initialize();
/* Since there is no support for newlines in terminal_putchar yet, \n will
produce some VGA specific character instead. This is normal. */
terminal_writestring("Hello, kernel World!\n");
}
[/code]
I made a makefile:
[code]
bin/muagetdua.bin:
nasm -felf src/boot.asm -o bin/boot.o
gcc -c src/kernel.c -o bin/kernel.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra
gcc -T link.ld -o muagetdua.bin -ffreestanding -O2 -nostdlib bin/boot.o bin/kernel.o -lgcc
[/code][/QUOTE]
As long as you are writing this in pure C (not C++), you shouldn't have trouble with name mangling, but just to be safe I would recommend compiling the C into equivalent assembly (or just compile preserving symbols on a full compile) to check what the linker actually sees `kernel_main` as. Other than that I haven't a clue because I can call C functions from asm without even declaring the symbol extern.
[editline]19th June 2013[/editline]
Looks like, depending upon your architecture and compiler and the alignment of the planets you may get symbols with underscores before them in C ([url=http://www.nasm.us/doc/nasmdoc9.html]see here for details[/url]) so you may want to try adding the underscore in your assembly source to see if it fixes anything.
The _start is the asm boot function, not name mangling.
*ahem*
[QUOTE=ZeekyHBomb;41100924]What's the output of objdump -t bin/kernel.o | grep kernel_main?[/QUOTE]
[QUOTE=Duskling;41101149]Could use some help real quick. I am trying to get a quad to move using pixels as units, but it doesn't work once I scale the quad. If I keep the scale at 1, 1, 1 then it moves 1 pixel when I translate it by Vector3f(1, 0, 0). But when I scale it to 16, moving it by one unit moves it by 16 pixels. How do I fix this? Here is what I am using for my orthographic projection.
createOrthographicMatrix(0, 640, 0, 360, near_plane, far_plane);[/QUOTE]
What order are you performing the scale/ translate operation? Sounds like you might be translating-scaling (which will scale up you translation) when you need to be scaling-translating, assuming I'm remembering my graphics stuff right :v:
[QUOTE=hexpunK;41102475]What order are you performing the scale/ translate operation? Sounds like you might be translating-scaling (which will scale up you translation) when you need to be scaling-translating, assuming I'm remembering my graphics stuff right :v:[/QUOTE]
Was just watching a movie when this occurred to me :) I will check it out.
Yep, turns out I was scaling before I translated. I feel dumb.
[QUOTE=Duskling;41103692]Was just watching a movie when this occurred to me :) I will check it out.
Yep, turns out I was scaling before I translated. I feel dumb.[/QUOTE]
Just gotta remember that scaling happens from the origin out, so anything done before a scale is scaled along with it to some extent. It caught me out a few times when I was working on an assignment.
[QUOTE=hexpunK;41103847]Just gotta remember that scaling happens from the origin out, so anything done before a scale is scaled along with it to some extent. It caught me out a few times when I was working on an assignment.[/QUOTE]
I think it's everything after a scale. Or I might just be confusing myself further. I am setting the position, then setting the scale, then setting the rotation. The position seems to be working fine, and it's not getting scaled ( I can move an object scaled at 16x16 in 1 pixel increments ) which is what I want.
EDIT:
Just looked it up and I am really confused now. I wish I had that .gif I saw a while ago that explained the correct order of transforming.
[QUOTE=Duskling;41104053]I think it's everything after a scale. Or I might just be confusing myself further. I am setting the position, then setting the scale, then setting the rotation. The position seems to be working fine, and it's not getting scaled ( I can move an object scaled at 16x16 in 1 pixel increments ) which is what I want.[/QUOTE]
I'm pretty tired right now, so that post I made probably wasn't very well worded. But at least it's working how you need it now.
Found em ( at least for rotating and translating )
[IMG]http://i.imgur.com/zKnh1.gif[/IMG][IMG]http://i.imgur.com/GAApw.gif[/IMG]
Credit: Tom Dalling, [url]http://tomdalling.com/blog/modern-opengl/03-matrices-depth-buffering-animation/[/url]
[QUOTE=Map in a box;41102563]That's weird.
[code]
D:\muagetdua>objdump -t bin/kernel.o | grep kernel_main
[ 11](sec 1)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x000001a0 _kernel_main
[/code][/QUOTE]
I understand that the linker uses the _start symbol as the entry point. I was referring to the mangling that you just confirmed (thanks for the command-line, ZeekyHBomb), that is your compiler mangled the C function name `kernel_main` into the symbol `_kernel_main`. The link I posted early explains it (or at least notes it, I'm really not sure [I]why[/I] this happens but it does).
If you plan to continue using this same architecture and compiler I suggest you start using the same naming scheme yourself; that is, prepend a _ to every function you define or call.
I absolutely positively do not want to do that :c
[editline]20th June 2013[/editline]
[sub][sub]gmod 9 nightmares oh god oh man save me[/sub][/sub]
[editline]20th June 2013[/editline]
I fixed it by just adding an _ to the .asm. Weird.
[editline]20th June 2013[/editline]
Now how would I test it? Bochs is saying it's not bootable.
[QUOTE=Map in a box;41106907]I absolutely positively do not want to do that :c
[editline]20th June 2013[/editline]
[sub][sub]gmod 9 nightmares oh god oh man save me[/sub][/sub]
[editline]20th June 2013[/editline]
I fixed it by just adding an _ to the .asm. Weird.
[editline]20th June 2013[/editline]
Now how would I test it? Bochs is saying it's not bootable.[/QUOTE]
I'm not sure, I do OS dev on the raspberry pi, which just loads 'kernel.img' in the first partition of the SDCard and starts executing at 0x0000; my "bootloader" is just a branch to 0x8000 :v:
Can someone tell me what the point of a unique key in MySQL is? Pretty much whenever I have fields in my tables that I know are unique I'll just turn them into a composite primary key, or is it just because I haven't run into a situation where I need a unique column that isn't commonly used to identify a row?
[QUOTE=EvacX;41127766]Can someone tell me what the point of a unique key in MySQL is? Pretty much whenever I have fields in my tables that I know are unique I'll just turn them into a composite primary key, or is it just because I haven't run into a situation where I need a unique column that isn't commonly used to identify a row?[/QUOTE]
A primary key is a special kind of unique key implemented as a convenience to programmers so you are in fact already using unique keys. I also don't think it's a good idea to use composite keys when it isn't necessary. It'll probably cost extra resources. When it's not necessary to use a composite key, but you have multiple columns that need to be unique, you'll use a unique key, as you can only have one primary key.
[QUOTE=mobrockers;41128019]A primary key is a special kind of unique key implemented as a convenience to programmers so you are in fact already using unique keys. I also don't think it's a good idea to use composite keys when it isn't necessary. It'll probably cost extra resources. When it's not necessary to use a composite key, but you have multiple columns that need to be unique, you'll use a unique key, as you can only have one primary key.[/QUOTE]
But when I have a table with 3 columns required to identify a single row I really don't see the need for a normal unique key, a composite primary key seems way more fitting, as the concept of primary keys is all about identifying a row in a table which is what I am doing.
[QUOTE=EvacX;41128616]But when I have a table with 3 columns required to identify a single row I really don't see the need for a normal unique key, a composite primary key seems way more fitting, as the concept of primary keys is all about identifying a row in a table which is what I am doing.[/QUOTE]
If you need 3 columns to be able to uniquely identify a row then that qualifies as necessary. Unnecessary is when a column needs to be unique, but isn't necessary to uniquely identify a row. There are use cases where columns need to be unique, but don't have to be combined in a composite primary key to identify a row, and thus you shouldn't do so because it can come at a performance cost (I don't actually know if it does or not).
I have a question about collision detection. I get that if the origin is inside the subtracted Minkowski shape, it means the shapes intersect. How do I check if the origin is inside it?
I'm having trouble finding a function that returns whether or not two ellipse overlap. I don't need to know the area that they overlap, just if they overlap at all. I don't want a function that determines if two ellipse intersect because I'd like it to return true if one is inside the other as well. I have the two ellipse saved in c# as Rectangles that have an x, y, width, and height. Any help would be appreciated.
[B]EDIT: Nevermind, I'll just use TakeDamage();[/B]
Can anyone tell me how player death works in source engine? Calling Event_Killed() does kill the player but it seems like the player entity is deleted and they are no longer able to spawn afterwards.
Do I need to handle creating a new entity/respawning myself? That doesn't seem right.
With some day-dreaming, assuming the security and maintenance of the software, could a BIOS be programmed to specifically handle or route web requests?
Or, what would be the thinnest setup, regarding layers of software, between booting and serving requests?
[QUOTE=Zwolf11;41137724]I'm having trouble finding a function that returns whether or not two ellipse overlap. I don't need to know the area that they overlap, just if they overlap at all. I don't want a function that determines if two ellipse intersect because I'd like it to return true if one is inside the other as well. I have the two ellipse saved in c# as Rectangles that have an x, y, width, and height. Any help would be appreciated.[/QUOTE]
It's the same as for circles, except that instead of the radii you use a combination of the axes (a * cos φ + b * sin φ where φ is the angle between the centre-connecting vector and the major axis, for each ellipse).
If your ellipses are axis-aligned this should simplify to x²/(a_1 + a_2)² + y²/(b_1 + b_2)² < 1 but I didn't check. x and y are from the centre offset vector, a and b are the axes aligned with the x- and y-axis, respectively.
[editline]22nd June 2013[/editline]
[QUOTE=Epiclulz762;41137980]With some day-dreaming, assuming the security and maintenance of the software, could a BIOS be programmed to specifically handle or route web requests?
Or, what would be the thinnest setup, regarding layers of software, between booting and serving requests?[/QUOTE]
Probably not the BIOS, but a UEFI boot image should be able to do that. I read somewhere that it's possible to write a UEFI-mitm, so a web server should certainly be possible.
I'm doing 2D camera work and I'm trying to translate my mouse co-ordinates to take into account the camera's zoom, rotation and translation. I've got translation down, but I can't get my head around the other two. Here's a video (the white square is the calculated mouse position and the cursor is the actual mouse position):
[video=youtube;coqmWRUB53s]http://www.youtube.com/watch?v=coqmWRUB53s[/video]
I swear I've come to FP for help doing this for about six different projects. Just won't stick!
[b]Edit:[/b]
Figured zooming out with this code:
[code]
Vector2f screenCenter = new Vector2f(Game.window_width/2, Game.window_height/2);
mousePos = screenCenter.add((mousePos.copy().sub(screenCenter).scale((1/Camera.scale))));[/code]
Now I just need to figure out rotation. The mouse position is rotating around the origin rather than the center.
[QUOTE=Nigey Nige;41140959]-snip-[/QUOTE]
I think you'd need Vector.Rotate for the rotation.
[lua]
function vectorfuncs:Rotate( radAng )
local angcos = math.cos(radAng)
local angsin = math.sin(radAng)
self = Vector(
self.x*angcos - self.y*angsin,
self.x*angsin + self.y*angcos
)
end
[/lua]
Written in lua, perhaps you can scavange from it.
Rotate rotates around 0,0, so you'd need to de-translate the position and translate it again afterwards.
[QUOTE=ZeekyHBomb;41055769]Just found out about the [URL="http://en.cppreference.com/w/cpp/language/noexcept"]noexcept operator[/URL]. That should help you.[/QUOTE]
I was revisiting this to make sure I hadn't missed something. The frustrating thing is that it almost works. Instead of checking for type traits you can check noexcept(*Output = std::move(*First)) on the iterators. The problem is that it only fully works if the iterator is a pointer. Any kind of iterator class no matter what it does will end up copying and not moving because they call functions that are either not properly noexcept (i'm not sure if it's possible but if it is it would of course involve a whole lot of the noexcept operator in their noexcept specifications), or call functions that can throw exceptions (push_back of back_insert_iterator for example). In the context of these functions it's actually okay if exceptions are thrown as long as they are not related to moving but of course noexcept doesn't care.
Considering that none of this is actually important it's probably time to stop trying to fix it. It's just something i've kind of had in the back of my mind for no real reason. I generally try to stay way further out of the c++ rabbit hole than this.
Hey there, any idea if its possible to debug and attach to a process in Visual studio C# 2010 Express?
From what I have searched it seems that the feature is not available in visual studio express versions, is there perhaps some workaround to have debug or the only solution is to purchase the pro version or whatever version has that feature?
Visual Studio 2012 at least can attach to processes even if they're not launched from it.
Express too.
Okay, I get that in pygame you have to erase all the stuff on a surface before you modify it again otherwise you get "trails" where the object has moved. But I can't seem to figure out exactly how to do this. I've tried using fill operations and so on at every point in the order of execution but I can't get it to work. Here I've stripped out all that stuff. How do I get the trails to disappear?
[img]http://i.imgur.com/WVIJszN.png[/img]
(also it doesn't want to rotate about its center because rotate changes the size, but I think I can fix that one)
blit both surfaces to the screen.
Sorry, you need to Log In to post a reply to this thread.