Are unordered maps ordered in the order elements are inserted? Because right now normal maps are screwing over my component based system.
The program crashes right away, console outputs
0
1
2
[url]http://pastebin.com/a6QR3VCB[/url]
edit:
Any reason as to why this happens? I'm not sure why, pretty sure the files are loading or it would tell me
Okay, this makes me feel really incompetent, but I'm going to ask here because Googling has given me only limited success.
So I decided to jump into C++, just because it's something I've been meaning to do. Like all the other times I jump into a new language, I have a goal in mind to work towards, which is, in this case, a fairly straightforward 2D game.
However, I am having some issues.
Basically, I decided I want to try using OpenGL for this. I looked around, and it looks like I want to use SFML. I've seen a lot of people say that "GLEW is almost essential," but it appears that GLEW's sourceforge site is down, so I'm sticking with SFML for now.
However, I have absolutely no idea how to get Visual Studio C++ 2010 to use it, and the few tutorials I've seen for it are either in too poor detail for me to follow, or are otherwise incomplete (one I found referenced some files it "told us to download earlier," but there was no "earlier" and there never was a download, so yeah...)
Anyone got any advice for me? I really don't want to give up on C++ / OpenGL before I can even start, because C++ looks like a fairly fun language to play with, and OpenGL a fairly easy library to work with (at least for simple things, like a 2D game).
Thanks guys. :v:
[QUOTE=WTF Nuke;35788256]Are unordered maps ordered in the order elements are inserted? Because right now normal maps are screwing over my component based system.[/QUOTE]
No, "unordered map" is usually codespeak for "hash table", so iteration would probably return the elements in order of their hash values. But really, "unordered" means you shouldn't rely on the elements being in any particular order at all. In principle, an implementation [i]could[/i] return the elements in [i]random[/i] order that differs every time you traverse the map.
Anyone know an equation to calculate the number of faces of a mesh? Have 64,000 vertices arranged in a 40x40x40 grid. Don't know how many faces though.
If it's a grid, subtract one from each dimension and multiply the numbers together. But for an arbitrary (non-grid) mesh, it depends on how the vertices are connected together.
[b]Edit:[/b] And if your 40x40x40 grid has the "internal" faces hidden, then it's not 39*39*39, it's 6*(39*39). Again, all depends on how things are connected.
[b]Edit 2:[/b] And my formula is wrong anyway. A 2x2x2 grid mesh (aka "cube") clearly has six faces, not 1*1*1.
Can I have a map that is ordered by the order of insertion?
[QUOTE=WTF Nuke;35788873]Can I have a map that is ordered by the order of insertion?[/QUOTE]
You could use a list of key/value pairs, and a map that translates keys into list items. When you add a new element, look it up the map and if it's not there already, add it to the end of the list and then add a map entry pointing to the new list item.
[QUOTE=Wyzard;35788850]If it's a grid, subtract one from each dimension and multiply the numbers together. But for an arbitrary (non-grid) mesh, it depends on how the vertices are connected together.
[b]Edit:[/b] And if your 40x40x40 grid has the "internal" faces hidden, then it's not 39*39*39, it's 6*(39*39). Again, all depends on how things are connected.[/QUOTE]
Gah, then it might just be an issue with what I'm doing. Assumed SetVertexData() was failing because the number of faces wasn't correct, but it might be because of how I actually managed to create an array that big without causing a stack overflow.
What a way to start programming. I'm already confused, and I [I]haven't even finished setting up.[/I]
I downloaded [U]Microsoft Visual C# 2010 Express[/U] because that's what this programming book says to use for now, and I can't find out how to launch it.
Either I'm retarded, or I'm retarded, but I can't figure it out.
fuck help :v:
[QUOTE=NateDude;35789027]What a way to start programming. I'm already confused, and I [I]haven't even finished setting up.[/I]
I downloaded [U]Microsoft Visual C# 2010 Express[/U] because that's what this programming book says to use for now, and I can't find out how to launch it.
Either I'm retarded, or I'm retarded, but I can't figure it out.
fuck help :v:[/QUOTE]
[img]http://i.imgur.com/eszTK.png[/img]
Double click this motherfucker?
[QUOTE=TM Gmod;35789101][img]http://i.imgur.com/eszTK.png[/img]
Double click this motherfucker?[/QUOTE]
[thumb]http://puu.sh/stKZ[/thumb]
Oh shortcut, oh shortcut, where art thou?
[editline]1st May 2012[/editline]
[thumb]http://puu.sh/stLj[/thumb]
Not here either
for FUCKS-HNGGG
[QUOTE=NateDude;35789125]Oh shortcut, oh shortcut, where art thou?[/QUOTE]
On your Start menu, under "All Programs", there should be a folder titled "Microsoft Visual Studio 2010 Express". If it's not there, something's wrong with your VS installation.
[QUOTE=Wyzard;35789188]On your Start menu, under "All Programs", there should be a folder titled "Microsoft Visual Studio 2010 Express". If it's not there, something's wrong with your VS installation.[/QUOTE]
[IMG]http://puu.sh/stQe[/IMG]
oh
Damnit, what the hell, re-installing.
It's late, so I might not end up doing it tonight :suicide:
I sware to [B]GOD[/B] if I end up procrastinating tommorow I will shoot myself.
Right, I'm trying to get an animated dragon model into my XNA program, and I'm using SkinnedEffect to draw the shit with, now, my dragon has 143 bones, when I try and start the program it says "Skeleton has 143 bones, but the maximum supported is 72.", is there any way to change this limit? I fucking hate it.
[QUOTE=Wyzard;35788910]You could use a list of key/value pairs, and a map that translates keys into list items. When you add a new element, look it up the map and if it's not there already, add it to the end of the list and then add a map entry pointing to the new list item.[/QUOTE]
Thanks for the idea, I found another where I just have a vector that I run alongside the map and just push back whenever I insert into the map. Works like a charm, and fixes my game.
That's pretty much exactly what I said, except with a vector instead of a list. :-P
Then I misinterpreted it, my bad. Thanks anyway.
[QUOTE=raccoon12;35788718]The program crashes right away, console outputs
0
1
2
[url]http://pastebin.com/a6QR3VCB[/url]
edit:
Any reason as to why this happens? I'm not sure why, pretty sure the files are loading or it would tell me[/QUOTE]
anyone? :(
[QUOTE=shill le 2nd;35787687]No, I told you [i]not[/i] to the link the .dll; link the .lib instead.
EDIT: is that really .dll or did you make a typo? I can't even find an fmodexL64_vc.dll in my FMOD; only fmodexL64_vc.lib (which is what you should be linking) and fmodexL64.dll (none of the DLLs have a "vc" suffix because they get loaded at runtime, which makes them compiler-agnostic)
EDIT2: And are you sure you should be using the 64-bit lib?[/QUOTE]
It was a typo, and I'm using 64 bit Windows 7.
How would I go about translating mouse co-ordinates to world co-ordinates? There's documentation on how its done but its mostly for Python/C and I'm working in Lua.
[QUOTE=nick10510;35790191]How would I go about translating mouse co-ordinates to world co-ordinates? There's documentation on how its done but its mostly for Python/C and I'm working in Lua.[/QUOTE]
3D, 2D side-scrolling or isometric?
I'm doing a double iteration on a array list.
[code]
for (listIteratorA = list.iterator();listIteratorA.hasNext();){
TypeA i = listIteratorA.next();
for (listIteratorB = list.iterator();listIteratorB.hasNext();){
TypeA k = listIteratorB.next();
checkCollisions(i,k);
}
}
[/code]
Some where in my check collision function
[code]
listIteratorA.remove();
listIteratorB.remove();
[/code]
I am getting a "Exception in thread "Animation Thread" java.util.ConcurrentModificationException". What should I do so I don't get this error and still be able to continue looping though the first list.
Also I know this is a terrible way to check for collisions but that's not the point.
[QUOTE=ROBO_DONUT;35790220]3D, 2D side-scrolling or isometric?[/QUOTE]
2D with a free moving camera.
Assuming camPos is relative to upper-left corner and mouse coords are relative to upper left:
vec2 worldPos = camPos + mouseScreenPos;
Assuming camPos is relative to center of the screen:
vec2 worldPos = new vec2(camPos.x - (screenWidth / 2), camPos.y - (screenHeight / 2)) + mouseScreenPos;
Someone is probably going to strangle me for this, but here goes. Since I couldn't make a 3D array that was [40][40][40] I used calloc to do so. Well I ran into more issues and now my program is shooting itself in the head whenever I call CreateBuffer in D3D10.
Code.
[code]
meshVertex*** vertexLoad;
vertexLoad = (meshVertex***) calloc(40, sizeof(meshVertex**));
for(int i = 0; i < 40; i++)
vertexLoad[i] = (meshVertex**) calloc(40, sizeof(meshVertex*));
for(int i = 0; i < 40; i++)
for(int f = 0; f < 40; f++)
vertexLoad[i][f] = (meshVertex*)calloc(40, sizeof(meshVertex));
for(int x = 0; x < 4; x++)
{
for(int y = 0; y < 40; y++)
{
for(int z = 0; z < 40; z++)
vertexLoad[x][y][z].position = D3DXVECTOR3(x, y, z);
}
}
for(int x = 0; x < 4; x++)
{
for(int y = 0; y < 40; y++)
{
for(int z = 0; z < 40; z++)
vertexLoad[x][y][z].color = D3DXVECTOR4(1,0,0, 0);
}
}
D3D10_BUFFER_DESC vertexBuffer;
vertexBuffer.Usage = D3D10_USAGE_IMMUTABLE;
vertexBuffer.ByteWidth = sizeof(meshVertex) * 64000;
vertexBuffer.BindFlags = D3D10_BIND_VERTEX_BUFFER;
vertexBuffer.CPUAccessFlags = 0;
vertexBuffer.MiscFlags = 0;
D3D10_SUBRESOURCE_DATA vertexInit;
vertexInit.pSysMem = vertexLoad;
if(isFinalParent)
{
meshVector = vertexBuffer;
meshVectorTwo = vertexInit;
}
else
{
parentVector = &vertexBuffer;
parentVectorTwo = &vertexInit;
}
[/code]
Someone will probably shoot me for what I did with calloc() but oh well. meshVector and meshVectorTwo get returned by external functions that shouldn't effect why its failing and parentVector for now is useless.
Im trying to integrate libRocket but when I Render the context along with my stuff I get all this:
[code]
valgrind ./Pid
==14403== Memcheck, a memory error detector
==14403== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==14403== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==14403== Command: ./Pid
==14403==
==14403== Syscall param writev(vector[...]) points to uninitialised byte(s)
==14403== at 0x4604124: writev (writev.c:51)
==14403== by 0x40004: ???
==14403== Address 0x496893a is 58 bytes inside a block of size 16,384 alloc'd
==14403== at 0x402732C: calloc (vg_replace_malloc.c:467)
==14403== by 0x4711551: XOpenDisplay (in /usr/lib/i386-linux-gnu/libX11.so.6.3.0)
==14403== by 0x404F67C: _glfwPlatformInit (in /usr/local/lib/libglfw.so)
==14403== by 0x4552112: (below main) (libc-start.c:226)
==14403==
==14403== Invalid read of size 4
==14403== at 0x4E70112: _mesa_make_extension_string (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4E4A637: _mesa_make_current (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4D70B40: intelMakeCurrent (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D649AE: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x43EDB8C: ??? (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==14403== by 0x43C5B96: glXMakeContextCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==14403== by 0x43C5D22: glXMakeCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==14403== by 0x4052864: _glfwPlatformOpenWindow (in /usr/local/lib/libglfw.so)
==14403== by 0x404E510: glfwOpenWindow (in /usr/local/lib/libglfw.so)
==14403== by 0x8058E94: main (Main.cpp:51)
==14403== Address 0x4c33b58 is 0 bytes inside a block of size 1 alloc'd
==14403== at 0x402732C: calloc (vg_replace_malloc.c:467)
==14403== by 0x4E702DE: _mesa_make_extension_string (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4E4A637: _mesa_make_current (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4D70B40: intelMakeCurrent (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D649AE: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x43EDB8C: ??? (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==14403== by 0x43C5B96: glXMakeContextCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==14403== by 0x43C5D22: glXMakeCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==14403== by 0x4052864: _glfwPlatformOpenWindow (in /usr/local/lib/libglfw.so)
==14403== by 0x404E510: glfwOpenWindow (in /usr/local/lib/libglfw.so)
==14403== by 0x8058E94: main (Main.cpp:51)
==14403==
Version: v0001
Using OpenGL 2.1
Using resolution: 1024x576
Antialiasing Level of 2 was unavailable, using level 0 instead.
Status: Using GLEW 1.6.0
Loaded font face Delicious Roman (from ./assets/Delicious-Roman.otf).
Loaded font face Delicious Italic (from ./assets/Delicious-Italic.otf).
Loaded font face Delicious Bold (from ./assets/Delicious-Bold.otf).
Loaded font face Delicious Bold Italic (from ./assets/Delicious-BoldItalic.otf).
Loaded font face Lacuna Regular Regular (from byte stream).
Loaded font face Lacuna Italic Regular (from byte stream).
Compiling shader : ./basic.vert
Compiling shader : ./basic.frag
Linking program
Compiling shader : ./basic.vert
Compiling shader : ./basic.frag
Linking program
==14403== Invalid read of size 1
==14403== at 0x402A668: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D85509: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x22640C24: ???
==14403== Address 0xb7765600 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A682: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D85509: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x22640C24: ???
==14403== Address 0xb7765601 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A668: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D9F994: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D9FBF7: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA568C: brw_validate_state (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D921AA: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== Address 0xb7765e80 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A682: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D9F994: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D9FBF7: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA568C: brw_validate_state (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D921AA: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== Address 0xb7765e81 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 4
==14403== at 0x4F15540: vbo_get_minmax_index (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4D9284B: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4F149ED: ??? (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4F14BB1: ??? (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x80539F8: Drawable::Draw() (Drawable.cpp:323)
==14403== by 0x805E27E: Room::Draw() (Room.cpp:236)
==14403== by 0x805B0FF: Program::Draw() (Program.cpp:280)
==14403== by 0x80594AA: main (Main.cpp:183)
==14403== Address 0xb7761000 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 4
==14403== at 0x4F15552: vbo_get_minmax_index (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4D9284B: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4F149ED: ??? (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4F14BB1: ??? (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x80539F8: Drawable::Draw() (Drawable.cpp:323)
==14403== by 0x805E27E: Room::Draw() (Room.cpp:236)
==14403== by 0x805B0FF: Program::Draw() (Program.cpp:280)
==14403== by 0x80594AA: main (Main.cpp:183)
==14403== Address 0xb7761008 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A668: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DAF8B2: do_wm_prog (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DAFEB7: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== Address 0xb775e240 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A682: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DAF8B2: do_wm_prog (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DAFEB7: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== Address 0xb775e241 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A668: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA667E: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA6855: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA568C: brw_validate_state (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D921AA: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== Address 0xb775ea80 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403== Invalid read of size 1
==14403== at 0x402A682: bcmp (mc_replace_strmem.c:679)
==14403== by 0x4DA35C8: brw_upload_cache (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA667E: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA6855: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4DA568C: brw_validate_state (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4D921AA: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== Address 0xb775ea81 is not stack'd, malloc'd or (recently) free'd
==14403==
==14403==
==14403== Process terminating with default action of signal 11 (SIGSEGV)
==14403== Access not within mapped region at address 0xBDC58380
==14403== at 0x4F15540: vbo_get_minmax_index (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4D9284B: brw_draw_prims (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==14403== by 0x4F149ED: ??? (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x4F14BB1: ??? (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==14403== by 0x805FB06: ShellRenderInterfaceOpenGL::RenderGeometry(Rocket::Core::Vertex*, int, int*, int, unsigned int, Rocket::Core::Vector2<float> const&) (ShellRenderInterfaceOpenGL.cpp:59)
==14403== by 0x426AA85: Rocket::Core::Geometry::Render(Rocket::Core::Vector2<float> const&) (Geometry.cpp:144)
==14403== by 0x41C2FD1: Rocket::Core::DecoratorTiledBox::RenderElement(Rocket::Core::Element*, unsigned int) (DecoratorTiledBox.cpp:297)
==14403== by 0x41DA775: Rocket::Core::ElementDecoration::RenderDecorators() (ElementDecoration.cpp:172)
==14403== by 0x4208614: Rocket::Core::Element::Render() (Element.cpp:178)
==14403== by 0x420864A: Rocket::Core::Element::Render() (Element.cpp:185)
==14403== by 0x420864A: Rocket::Core::Element::Render() (Element.cpp:185)
==14403== by 0x41F8129: Rocket::Core::Context::Render() (Context.cpp:156)
==14403== If you believe this happened as a result of a stack
==14403== overflow in your program's main thread (unlikely but
==14403== possible), you can try to increase the size of the
==14403== main thread stack using the --main-stacksize= flag.
==14403== The main thread stack size used in this run was 8388608.
==14403==
==14403== HEAP SUMMARY:
==14403== in use at exit: 43,360,094 bytes in 33,457 blocks
==14403== total heap usage: 176,724 allocs, 143,267 frees, 54,587,153 bytes allocated
==14403==
==14403== LEAK SUMMARY:
==14403== definitely lost: 480 bytes in 3 blocks
==14403== indirectly lost: 0 bytes in 0 blocks
==14403== possibly lost: 22,749,046 bytes in 9,833 blocks
==14403== still reachable: 20,610,568 bytes in 23,621 blocks
==14403== suppressed: 0 bytes in 0 blocks
==14403== Rerun with --leak-check=full to see details of leaked memory
==14403==
==14403== For counts of detected and suppressed errors, rerun with: -v
==14403== Use --track-origins=yes to see where uninitialised values come from
==14403== ERROR SUMMARY: 7987 errors from 12 contexts (suppressed: 93 from 11)
Segmentation fault
[/code]
Drawable 323 is:
[cpp]glDrawElements(
GL_TRIANGLES, // mode
index_data.size(), // count
GL_UNSIGNED_INT, // type
(void*)0 // element array buffer offset
);[/cpp]
If I comment out my own openGL sraw stuff then i dont get the segfault but nothing gets displayed
[QUOTE=darkrei9n;35790372]Someone is probably going to strangle me for this, but here goes. Since I couldn't make a 3D array that was [40][40][40] I used calloc to do so.[/QUOTE]
Using malloc or calloc to allocate your buffer on the heap is perfectly reasonable — typical, in fact. But the double indirection, with pointers to pointers, is not. What you have now is not one buffer to hold all the data, but 1600 separately-allocated 40-element buffers scattered around in memory.
You want to do calloc(40*40*40, sizeof(meshVertex)) to get a [i]single[/i] contiguous buffer. You'll have to convert the X/Y/Z coordinates into linear array indices yourself. (Or you can use something like Boost's [url=http://www.boost.org/doc/libs/1_49_0/libs/multi_array/doc/user.html]multi_array[/url].)
[QUOTE=Lord Ned;35790301]Assuming camPos is relative to upper-left corner and mouse coords are relative to upper left:
vec2 worldPos = camPos + mouseScreenPos;
Assuming camPos is relative to center of the screen:
vec2 worldPos = new vec2(camPos.x - (screenWidth / 2), camPos.y - (screenHeight / 2)) + mouseScreenPos;[/QUOTE]
Neither is working.
What I use to calculate the cameras position ( it centers the screen on the player ):
[lua]game.CamX, game.CamY = (love.graphics.getWidth()/((game.scale+1)*2)) - ply.Pos.x, (love.graphics.getHeight()/((game.scale+1)*2)) - ply.Pos.y;[/lua]
Changed it to a 1D. However still crash.
[code]
meshVertex* vertexLoad;
vertexLoad = (meshVertex*) calloc(40*40*40, sizeof(meshVertex));
int i = 0;
for(int x = 0; x < 4; x++)
{
for(int y = 0; y < 40; y++)
{
for(int z = 0; z < 40; z++)
vertexLoad[i].position = D3DXVECTOR3(x, y, z);
i++;
i++;
}
i++;
}[/code]
Sorry, you need to Log In to post a reply to this thread.