[QUOTE=darkrei9n;35790821]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][/QUOTE]
Where does it crash? calloc should return NULL if it couldn't allocate enough memory.
[QUOTE=nick10510;35790816]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][/QUOTE]
Add some print statements about where your camera currently is, where your mouse currently is, and where you click is.
Its not Calloc causing it.
[img_thumb]http://puu.sh/svas[/img_thumb]
Doesn't specify anywhere on the code that I'm writing. I do know its caused by a CreateBuffer() with the exception std::out_of_range.
[QUOTE=darkrei9n;35790821]Changed it to a 1D. However still crash.[/QUOTE]
That should be:
[code]
meshVertex* vertexLoad = (meshVertex*) calloc(40*40*40, sizeof(meshVertex));
int i = 0;
for(int x = 0; x < 40; x++)
{
for(int y = 0; y < 40; y++)
{
for(int z = 0; z < 40; z++)
{
vertexLoad[i].position = D3DXVECTOR3(x, y, z);
i++;
}
}
}[/code]
Only the inner loop should increment the array index; otherwise you're skipping over elements, and will end up running off the end of the array.
Note that I changed "x < 4" to "x < 40" — I'm assuming that was a typo. I also combined the declaration and assignment of vertexLoad into one line, since doing those things separately accomplishes nothing but makes you type the variable name twice.
Also, you should really use named constants like SIZE_X, SIZE_Y, SIZE_Z instead of hard-coding the number 40 all over the place.
[QUOTE=Richy19;35790477]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]
[QUOTE=Wyzard;35790955]That should be:
[code]
meshVertex* vertexLoad = (meshVertex*) calloc(40*40*40, sizeof(meshVertex));
int i = 0;
for(int x = 0; x < 40; x++)
{
for(int y = 0; y < 40; y++)
{
for(int z = 0; z < 40; z++)
{
vertexLoad[i].position = D3DXVECTOR3(x, y, z);
i++;
}
}
}[/code]
Only the inner loop should increment the array index; otherwise you're skipping over elements, and will end up running off the end of the array.
Note that I changed "x < 4" to "x < 40" — I'm assuming that was a typo. I also combined the declaration and assignment of vertexLoad into one line, since doing those things separately accomplishes nothing but makes you type the variable name twice.
Also, you should really use named constants like SIZE_X, SIZE_Y, SIZE_Z instead of hard-coding the number 40 all over the place.[/QUOTE]
Still crashing, same error but different spot it appears.
[img_thumb]http://puu.sh/svmu[/img_thumb]
Also not using named constants for now because its simply a test, planning on expanding it later but for now I just want to be able to do a quick test of some stuff.
[QUOTE=darkrei9n;35791111]Still crashing, same error but different spot it appears.
[img_thumb]http://puu.sh/svmu[/img_thumb]
Also not using named constants for now because its simply a test, planning on expanding it later but for now I just want to be able to do a quick test of some stuff.[/QUOTE]
Hit break and run the callstack backwards (just click up it) and see what line it actually crashes on. :/
[QUOTE=Lord Ned;35791157]Hit break and run the callstack backwards (just click up it) and see what line it actually crashes on. :/[/QUOTE]
[code]
pD3DDevice->CreateBuffer(&bufferRet, &subData, &terrainList.at(0));[/code]
Look at the arguments being passed to that function call. Do they make sense?
[QUOTE=Wyzard;35791231]Look at the arguments being passed to that function call. Do they make sense?[/QUOTE]
Hm, since I'm using calloc is it possible that the function doesn't know the upper bound for it?
For Gwen, what .libs do you need for integration with OpenGL?
-snip
[QUOTE=Meatpuppet;35790167]It was a typo, and I'm using 64 bit Windows 7.[/QUOTE]
Yes, but are you compiling a 64-bit application? If not, you'll want to use the 32-bit library.
[QUOTE=darkrei9n;35791267]Hm, since I'm using calloc is it possible that the function doesn't know the upper bound for it?[/QUOTE]
You mean the size of the buffer that you allocated? It can't determine that from the pointer; you have to specify it separately. I have zero experience with D3D, but looking at the [url=http://msdn.microsoft.com/en-us/library/windows/desktop/bb204896%28v=vs.85%29.aspx]API reference[/url], it looks like the buffer size is the first member of your bufferRet structure. That should be set to 40*40*40*sizeof(meshVertex).
I just cant figure out how to fix the depth testing in my XNA game. Im changing the depth testing in this way:
[code]dsState = new DepthStencilState();
dsState.DepthBufferFunction = CompareFunction.LessEqual;
dsState.DepthBufferEnable = true;
device.DepthStencilState = dsState;[/code]
And just in case, this is how i make the vertices to render:
[code]public class Wall : MapPart {
public Wall(Vector3 position, float currentwall, float imagesInTexture)
: base(position)
{
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z - 1), new Vector3(0, 0, 1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z - 1), new Vector3(0, 0, 1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, 0, -position.Z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z - 1), new Vector3(0, 0, 1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z - 1), new Vector3(0, 0, 1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z - 1), new Vector3(0, 0, 1), new Vector2((currentwall * 2) / imagesInTexture, 0)));
//back wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z), new Vector3(0, 0, -1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, 0, -position.Z), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z), new Vector3(0, 0, -1), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z), new Vector3(0, 0, -1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
//left wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, 0, -position.Z), new Vector3(1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, 0, -position.Z - 1), new Vector3(1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z - 1), new Vector3(1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z - 1), new Vector3(1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z), new Vector3(1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, 0, -position.Z), new Vector3(1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
//right wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z), new Vector3(-1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z - 1), new Vector3(-1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z - 1), new Vector3(-1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z - 1), new Vector3(-1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, 0, -position.Z), new Vector3(-1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z), new Vector3(-1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
}
}
public Floor(Vector3 position, float currentwall, float imagesInTexture)
: base(position)
{
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z), new Vector3(0, -1, 0), new Vector2(currentwall * 2 / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z - 1), new Vector3(0, -1, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z), new Vector3(0, -1, 0), new Vector2((currentwall * 2 + 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X, position.Y, -position.Z - 1), new Vector3(0, -1, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z - 1), new Vector3(0, -1, 0), new Vector2((currentwall * 2 + 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(position.X + 1, position.Y, -position.Z), new Vector3(0, -1, 0), new Vector2((currentwall * 2 + 1) / imagesInTexture, 1)));
}
[Camera class stuff from now on]
private void SetUpMapPieces()
{
float imagesInTexture = 2;
int mapWidth = floorPlan.GetLength(0);
int mapLength = floorPlan.GetLength(1);
for (int x = 0; x < mapWidth; x++)
{
for (int z = 0; z < mapLength; z++)
{
int currentwall = floorPlan[x, z];
float wallHeight = 1f * currentwall;
if (currentwall == 1)
{
Wall wall = new Wall(new Vector3(x, wallHeight, z), currentwall, imagesInTexture);
mapPieces.Add(wall);
}
Floor floor = new Floor(new Vector3(x, wallHeight, z), currentwall, imagesInTexture);
mapPieces.Add(floor);
}
}
Console.WriteLine(mapPieces.Count + " map pieces loaded");
SetUpVertices();
}
private void SetUpVertices()
{
Console.WriteLine("Creating vertice list, this may take a while...");
List<VertexPositionNormalTexture> verticesList = new List<VertexPositionNormalTexture>();
foreach (MapPart part in mapPieces)
{
foreach (VertexPositionNormalTexture vertex in part.GetVertices())
{
verticesList.Add(vertex);
}
}
mapVertexBuffer = new VertexBuffer(device, VertexPositionNormalTexture.VertexDeclaration, verticesList.Count, BufferUsage.WriteOnly);
mapVertexBuffer.SetData<VertexPositionNormalTexture>(verticesList.ToArray());
Console.WriteLine(verticesList.Count + " vertices created");
}[/code]
That code is messed up because too long lines, but you'll understand it i guess.
Trying to make a client chat app.
Just have a quick question wondering if anybody could help me out.
I want a counter for how many clients are in the chat, and I also want to change the serverThread to be a consumer thread.
Anybody have any advice on how to do this?
[url]http://pastebin.com/sXQDtZyz[/url]
I'm trying to understand this piece of code. Can someone help me out? I don't understand what's going on where the array is being set (line 13). I got it from a tutorial which didn't seem to mention the specifics of this.
[cpp]// Get bitmap properties
int width, height;
width = getNextPower2(bitmap.width);
height = getNextPower2(bitmap.rows);
GLubyte* expanded_data = new GLubyte[2 * width * height];
// Fill in data for expanded bitmap
for(int j=0; j <height;j++)
{
for(int n=0; n < width; n++)
{
expanded_data[2*(n+j*width)]= expanded_data[2*(n+j*width)+1] = (n >= bitmap.width || j >= bitmap.rows) ? 0 : bitmap.buffer[n + bitmap.width*j];
}
}[/cpp]
Edit:
Does it set the value of [b]index n+bitmap.width*j[/b] to [i]0[/i] if the condition [b](n >= bitmap.width or j >= bitmap.rows)[/b] returns [i]true[/i]?
Edit: Nevermind, I figured it out.
What the fuck
Everytime I install [U]Microsoft Visual C# 2010 Express[/U], No .exe file appears and the folder keeps becoming empty
[IMG]http://puu.sh/syIv[/IMG]
[Highlight]I just want to start coding already goddamnit[/highlight]
[B]Edit:[/B] The actual folder isn't helping either
[thumb]http://puu.sh/syJW[/thumb]
[thumb]http://puu.sh/syKe[/thumb]
[B]Edit:[/B] Goddamnit I really wanted to start coding
I know it will be awhile before I get good enough to actually make games but I have to start somewhere and this thing is being aaaaaaaannnnooooooooyyyyyyyyyyyyyyyyyyyyiiiiiiinnnnnnggggggg.
I'm seriously BUMMED OUT.
[B]Edit:[/B] Does anybody know? :suicide:
I need some advice/ideas on how to generate graph capable of representing city streets (manhattan style, so grid based streets) procedurally.
But I want to be able to do it in chunks (think minecraft chunks) in order to do it in parallel and only when neew areas are needed.
Any ideas?
Is it a terrible idea to have a window class that can only be created on the heap (as in can only be created with the operator new)? The reason why I'm doing this in the first place is because I want to delete the windows as soon as the user has closed them.
[QUOTE=NateDude;35795396][B]Edit:[/B] Does anybody know? :suicide:[/QUOTE]The .exe is in 'COMMON/ide'. Its in the Visual Studio folder I think, one folder up from where your looking. I was going to post the full path but facepunch died right when I was about to post and now im not home.
[QUOTE=Darkest_97;35796556]The .exe is in 'COMMON/ide'. Its in the Visual Studio folder I think, one folder up from where your looking. I was going to post the full path but facepunch died right when I was about to post and now im not home.[/QUOTE]
I looked in there, and...
[thumb]http://puu.sh/sA2j[/thumb]
[thumb]http://puu.sh/sA2t[/thumb]
[thumb]http://puu.sh/sA2C[/thumb]
[thumb]http://puu.sh/sA2O[/thumb]
[video=youtube;XhI0OVs_zj0]http://www.youtube.com/watch?v=XhI0OVs_zj0[/video]
None of those .exe's actually did anything.
Foooooor Fuuuuuuuucks Saaaaaaaaake.
Is there any C ANSI or UNIX function that allows me to do Recursive directory searches? If not, what do I use to search dirs and check dir/file extensions?
It's a pain in the ass.
You need to make yourself a function to list directory contents with readdir() and stat(), then manually repeat for all subdirectories.
readdir() itself isn't re-entrant, so you need to be careful with it. readdir_r is the re-entrant alternative.
BSD has some nice functions for handling directories, which are supported on most Linux systems, but I don't think Windows has them. But even the regular posix stuff is better than WinAPI.
FUCK IT I'm download the 2011 Beta Version
I don't even give ANY SHITS what the book says if it doesn't fucking woooooooorrrrrrrrrk
[QUOTE=Lord Ned;35784921]I converted over to using WM_CHAR instead of WM_KEYDOWN and I can finally type in 0-9, !-), a-z, etc. It's a Christmas miracle!
I don't get arrow keys/backspace obviously (no WM_CHAR is generated), so I'll have to figure out how to shoe-horn in those.[/QUOTE]
I couldn't log in yesterday so little bit late reply, but you're still supposed to use all 3 events.
I don't mean to be a nag or annoying, but I really would like some help with this, and I haven't had any luck since posting this...
[QUOTE=Gmod4ever;35788780]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]
For clarification purposes, I decided to not bother with the linking, but follow the instructions on SFML's website for getting started, pasted below:
[quote]Copy the SFML development files to your Visual Studio installation directory
Copy SFML-x.y\include\SFML to the VC\include directory of your Visual Studio installation (so that you obtain VC\include\SFML)
Copy the *.lib files in SFML-x.y\lib to the VC\lib directory of your Visual Studio installation
[/quote]
And I get the same issues, which is, when I press F5 to compile (I'm doing the sample clock thing on the site [url=http://sfml-dev.org/tutorials/1.6/start-vc.php]here[/url]), I get errors about bad links or something. The errors are here:
[code]1>------ Build started: Project: asdf, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function _main
1>C:\Users\Jason\Documents\Visual Studio 2010\Projects\asdf\Debug\asdf.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/code]
With this code:
[code]#include <SFML/System.hpp>
#include <iostream>
int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
std::cout << Clock.GetElapsedTime() << std::endl;
sf::Sleep(0.5f);
}
return 0;
}[/code]
I've been looking around, and I guess it's something to do with the version of SFML I'm using being incompatible with VC++ 2010 or something? Any ideas about that?
[QUOTE=Philly c;35797112]I couldn't log in yesterday so little bit late reply, but you're still supposed to use all 3 events.[/QUOTE]
Yeah, it was more just figuring out how exactly to get it. Had a little trickery implementing WM_KEYDOWN/KEYUP again because it required an odd 3-step injection into Awesomium. I'm pretty well set now, been meaning to make sure it's all set and then post the final code here so anyone who finds it on google won't be so alone.
[url]http://www.newgrounds.com/dump/item/796d2bfdfdf60bad69b7b06f9acfddb9[/url]
Actionscript is pretty cool but my understanding of what everything meant was kind of loose. Where can I find a decent AS3 tutorial?
[QUOTE=NateDude;35796621]I looked in there, and...
-images-
[video=youtube;XhI0OVs_zj0]http://www.youtube.com/watch?v=XhI0OVs_zj0[/video]
None of those .exe's actually did anything.
Foooooor Fuuuuuuuucks Saaaaaaaaake.[/QUOTE]
Do a search for "devenv.exe" That's the EXE you're looking for.
More specifically, here's where my EXE is located:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Are you sure there were no installer errors?
It didn't SAY there were installation errors
The .exe isn't where you say it is
And no matter how many goddamn times I re-install, it isn't working.
[B]And Apparently the 2011 version ALSO BROKE[/B]
:suicide:
[B]Edit:[/B] I'm not touching the installation or anything, I'm installing EXACTLY how it tells me to.
For some reason it couldn't properly install 2011, so there's that
fucking
Sorry, you need to Log In to post a reply to this thread.