• What do you need help with? Version 1
    5,001 replies, posted
[QUOTE=Werem00se;26711019]I fixed it, thanks for the help guys. :fuckyou:[/QUOTE] I think you want :razz:
In C++, why would including <iostream> would cause a segfault ? Like, just including it. Not even calling std::cout or whatever.
While it could, it shouldn't. Some global variable getting its constructor called could cause it. Have you tried debugging?
[QUOTE=PiXeN;26717053]In C++, why would including <iostream> would cause a segfault ? Like, just including it. Not even calling std::cout or whatever.[/QUOTE] Post code
Apparently there's [editline]16th December 2010[/editline] there's Comodo Firewall causing it. Here's the code : [cpp] [/cpp] Here's the stack trace: [code] #0 012B27D3 ??() (C:\Windows\system32\guard32.dll:??) #1 00000000 0x6cdcb4b1 in ??() (??:??) #2 00000000 0x00000000 in ??() (??:??) [/code] gurad32.dll is a Comodo Firewall dll
Seems like your Firewall doesn't allow C++ I/O :v: You could just try unplugging the internet, disabling the firewall and run the program. If it still crashes, debug again. Also, did you build with full debug support?
[QUOTE=ZeekyHBomb;26728282]Seems like your Firewall doesn't allow C++ I/O :v: You could just try unplugging the internet, disabling the firewall and run the program. If it still crashes, debug again. Also, did you build with full debug support?[/QUOTE] errrr I'm using Code::Blocks's Debug mode if that's what you mean. [editline]16th December 2010[/editline] Ok, so apparently running it in release mode works Comodo doesn't likes debug mode fuck this shit i'm uninstalling comodo
It might not like the debugger for fishing in your program or something. Look if you can install an exception to allow gdb to do its work.
I tried to add exceptions, it wasn't working. Now that i uninstalled it it works perfectly.
In C# I have a Forms application with a WebBrowser control which is viewing a .swf document. I have a button on the form that, when pressed, should send a "SPACE" keypress to the .swf. Here is my OnClick code: [csharp]private void btnRun_Click( object sender, EventArgs e ) { wbGameView.Focus(); SendKeys.SendWait( " " ); }[/csharp] where wbGameView is the WebBrowser control. It works, but only if I click the button twice. Simply having the Focus() and SendWait( " " ) repeated again doesn't work. How can I make it do it in one press?
I've been trying to make a Conway's Game of Life implementation in lua with LÖVE, but I'm getting a weird expanding pattern instead of the expected output and I'm not sure what's causing it. Starting Generation: [media]http://img137.imageshack.us/img137/2987/gen1g.png[/media] 2nd Generation: [media]http://img155.imageshack.us/img155/5500/gen2i.png[/media] 3rd Generation: [media]http://img696.imageshack.us/img696/8940/gen3.png[/media] [code] function love.load() tile = {} for i=0,2 do tile[i] = love.graphics.newImage("tile"..i..".png") end screen_w = 800 screen_h = 800 tile_w = 20 tile_h = 20 map_tile_w = 40 map_tile_h = 40 cells = {} for i = 1, map_tile_w do cells[i] = {} for j = 1, map_tile_h do cells[i][j] = 0 end end cells[5][5] = 1 cells[6][5] = 1 cells[7][5] = 1 cells[30][30] = 1 cells[31][30] = 1 cells[32][30] = 1 cells[29][31] = 1 cells[30][31] = 1 cells[31][31] = 1 tempCells = {} for i = 1, map_tile_w do tempCells[i] = {} for j = 1, map_tile_h do tempCells[i][j] = 0 end end end function countNeighbours(x, y) count = 0 if x > 1 and y > 1 then if cells[x - 1][y - 1] == 1 then count = count + 1; end if cells[x][y - 1] == 1 then count = count + 1; end if cells[x - 1][y] == 1 then count = count + 1; end end if x < map_tile_w and y < map_tile_h then if cells[x + 1][y + 1] == 1 then count = count + 1; end if cells[x][y + 1] == 1 then count = count + 1; end if cells[x + 1][y] == 1 then count = count + 1; end end if x > 1 and y < map_tile_h then if cells[x - 1][y + 1] == 1 then count = count + 1; end end if x < map_tile_w and y > 1 then if cells[x + 1][y - 1] == 1 then count = count + 1; end end return count end function calcNextGen() for x = 1, map_tile_w do for y = 1, map_tile_h do neighbours = countNeighbours(x,y) if neighbours == 2 or neighbours == 3 then tempCells[x][y] = 1 end if neighbours < 2 or neighbours > 3 then tempCells[x][y] = 0 end end end cells = tempCells end function drawCells() for x=1, map_tile_h do for y=1, map_tile_w do love.graphics.draw(tile[cells[x][y]], (x*tile_w)-tile_w, (y*tile_h)-tile_h) end end end function love.draw() drawCells() calcNextGen() love.timer.sleep(500) end [/code] Any ideas?
I know this seems very specific, and it is. I'm working with Android and OpenGL ES right now. Does anyone know how to get an instance of GL10 in my subclass of GLSurfaceView? I extended the Renderer interface to require a new method for touch input, but I can't pass in GL10 because I don't know how to call it...
Hey guys, I have a small compiling error in C#. The error is Called CS1031 or "Type Expected" [csharp]double Am(8) = 0; // Getting the error for the # 8 inside the brackets [/csharp] I'm using that so I don't have to write Am1, Am2, Am3 - Am8 separately. EDIT: I'm trying to do an Array (Thanks MrBob for the word)
Not sure about C#, but do you mean you're trying to do an array? I think you use square brackets for those.
[QUOTE=MrBob1337;26778720]Not sure about C#, but do you mean you're trying to do an array? I think you use square brackets for those.[/QUOTE] Array! Thats the word.. Jesus, my I need a bigger vocabulary :frown: It didn't exactly work, I'm getting a lot more errors now. EDIT: Never mind thanks it worked
You use []-brackets for arrays and the brackets come after the type, not the variable name.
In XNA is there anyway to make the mouse position relate to the center of the window? and not the top left corner? Actually not from the center of the window, from a certain point of the window (the players position)
Im creating nameplates over my player, but im not sure how to position the healthbar so its smoothly over the player, no matter how long the name is it should always be in the "middle" if you know what i mean. Probably easy but ive been sitting here a while now with, and when i think i get a good result, i try to change the name and then its position is weird again, help? :( Edit: ive got the names size in pixels to my help
[QUOTE=peepin;26778677]Hey guys, I have a small compiling error in C#. The error is Called CS1031 or "Type Expected" [csharp]double Am(8) = 0; // Getting the error for the # 8 inside the brackets [/csharp] [/quote] :barf: What you're doing is VB.Net like arrays. Arrays in C# are done like this: [csharp] double[] Am = new double[9] {0, 48, 56, 1, 9, 0, 7, 9, 0}; [/csharp] The {0, 48, 56, 1, 9, 0, 7, 9, 0} is not necessary, it's just a quicker way to initialize into your arrays. You can still do Am[8] = 0; Also don't forget programmers start counting at 0. It you want to access Am(8), your array must have a capacity of 9.
[QUOTE=Tortex;26779644]Im creating nameplates over my player, but im not sure how to position the healthbar so its smoothly over the player, no matter how long the name is it should always be in the "middle" if you know what i mean. Probably easy but ive been sitting here a while now with, and when i think i get a good result, i try to change the name and then its position is weird again, help? :( Edit: ive got the names size in pixels to my help[/QUOTE] [cpp]namePos = playerPos + Vector(-nameLengthInPixels / 2, someHeightOffset);[/cpp]?
Would anyone mind giving me a minimal C++ OpenGL project that simply displays something on the screen (cube, triangle, whatever. I don't care what). The catch is that is has to use VBOs and have no deprecated functions. The issue is that I just can't seem to get anything working from scratch, I keep having to use deprecated stuff. Any help is GREATLY appreciated.
[url]http://freeglut.svn.sourceforge.net/viewvc/freeglut/tags/FG_2_6_0_RC3/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c?revision=852&view=markup[/url] at least non-deprecated OGL 3.1, not totally certain it is also non-deprecated OGL 4.1 though you could just try by setting the major version in the init-function to 4.
[QUOTE=ZeekyHBomb;26780668][url]http://freeglut.svn.sourceforge.net/viewvc/freeglut/tags/FG_2_6_0_RC3/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c?revision=852&view=markup[/url] at least non-deprecated OGL 3.1, not totally certain it is also non-deprecated OGL 4.1 though you could just try by setting the major version in the init-function to 4.[/QUOTE] That's perfect, thank you!
Not directly a programming issue, but it definitely doesn't need its own thread; Is there any sort of reference to F# that doesn't assume you have more than a year or two of other programming experience? Or is it just a bad idea to learn it when you don't know very much about programming in general?
Alright, here's what I have so far in my quest to use non-deprecated OpenGL [code]#include <iostream> #include <SFML/Window.hpp> #define GLEW_STATIC #include <GL/glew.h> #include "math3d.h" int main() { const int W = 800; const int H = 600; sf::Window window(sf::VideoMode(W, H), "Non-deprecated OpenGL", sf::Style::Close); bool keys[sf::Key::Count]; glewInit(); // Triangle vertex data GLfloat triangle[] = { -1.0f, -1.0f, -5.0f, 1.0f, -1.0f, -5.0f, 0.0f, 1.0f, -5.0f }; GLfloat colour[] = { 0.5f, 1.0f, 0.0f }; // Create a buffer to hold the data GLuint triangleBuffer; glGenBuffers(1, &triangleBuffer); // Hint that we'll be buffering a vertex array... glBindBuffer(GL_ARRAY_BUFFER, triangleBuffer); // And finally put the data into the buffer glBufferData(GL_ARRAY_BUFFER, sizeof(triangleBuffer), &triangleBuffer, GL_STATIC_DRAW); // Initialise OpenGL stuff glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set up some basic shaders const GLchar *vertShaderCode = "#version 140\n" "uniform mat4 mvpMatrix;\n" "in vec4 vertex;\n" "in vec3 inColour;\n" "out vec3 outColour;\n" "void main()\n" "{\n" "gl_Position = mvpMatrix * vertex;\n" "}\n"; const GLchar *fragShaderCode = "#version 140\n" "in vec3 inColour;\n" "out vec3 outColour;\n" "void main()\n" "{\n" "outColour = inColour;\n" "}\n"; // Create some new shaders GLuint vertShader = glCreateShader(GL_VERTEX_SHADER); GLuint fragShader = glCreateShader(GL_FRAGMENT_SHADER); // Put the code into them glShaderSource(vertShader, 1, &vertShaderCode, NULL); glShaderSource(fragShader, 1, &fragShaderCode, NULL); // Compile them glCompileShader(vertShader); glCompileShader(fragShader); GLint status; glGetShaderiv(vertShader, GL_COMPILE_STATUS, &status); if(status == GL_FALSE) { std::cerr << "Failed to load vertex shader" << std::endl; GLint logLength = 0; glGetShaderiv(vertShader, GL_INFO_LOG_LENGTH, &logLength); GLchar *log = new GLchar[logLength]; glGetShaderInfoLog(vertShader, logLength, &status, log); std::cerr << log << std::endl; delete[] log; } glGetShaderiv(fragShader, GL_COMPILE_STATUS, &status); if(status == GL_FALSE) { std::cerr << "Failed to load fragment shader" << std::endl; } // Link them into a program to use in rendering GLuint shaderProgram = glCreateProgram(); glAttachShader(shaderProgram, vertShader); glAttachShader(shaderProgram, fragShader); glLinkProgram(shaderProgram); glUseProgram(shaderProgram); // Get the location of the mvp matrix in the vertex shader GLint mvpmLocation = glGetUniformLocation(shaderProgram, "mvpMatrix"); // And also get the location of the colour and vertex attributes GLint colourLocation = glGetAttribLocation(shaderProgram, "inColour"); GLint vertexLocation = glGetAttribLocation(shaderProgram, "vertex"); // Construct a projection matrix M3DMatrix44f projectionMatrix; m3dMakePerspectiveMatrix(projectionMatrix, 35.0f, W / H, 0.0f, 100.0f); // And a modelview matrix M3DMatrix44f modelviewMatrix; m3dLoadIdentity44(modelviewMatrix); // And combine them into a modelview-projection matrix! M3DMatrix44f mvpMatrix; m3dMatrixMultiply44(mvpMatrix, projectionMatrix, modelviewMatrix); while(window.IsOpened()) { sf::Event e; while(window.GetEvent(e)) { switch(e.Type) { case(sf::Event::Closed): window.Close(); break; case(sf::Event::KeyPressed): if(e.Key.Code == sf::Key::Escape) window.Close(); else keys[e.Key.Code] = true; break; case(sf::Event::KeyReleased): keys[e.Key.Code] = false; break; default: break; } } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Tell the shader about our modelview projection matrix... glUniformMatrix4fv(mvpmLocation, 1, GL_FALSE, mvpMatrix); // Give it our triangle's vertices and colour glBindBuffer(GL_ARRAY_BUFFER, triangleBuffer); glVertexAttribPointer(vertexLocation, 9, GL_FLOAT, GL_FALSE, 0, triangle); glVertexAttribPointer(colourLocation, 3, GL_FLOAT, GL_FALSE, 0, colour); // Finally, we can do some drawing! glDrawArrays(GL_TRIANGLES, 0, 3); window.Display(); } // Remove our buffer objects glDeleteBuffers(1, &triangleBuffer); }[/code] It all compiles fine, but there's nothing drawing on the screen. I'm sure there's something that I've missed out, but I've been staring at this code for so long now, I can't work anything out anymore :v: Edit: As soon as this works, I'm putting this shit into classes, in separate files! Edit 2: Disregard this post, I've fixed all the problems I had
[QUOTE=Richy19;26779450]In XNA is there anyway to make the mouse position relate to the center of the window? and not the top left corner? Actually not from the center of the window, from a certain point of the window (the players position)[/QUOTE] Mouse position - the position of the point you want as center?
[del]What's the best way to get the path to the "My Documents" in Python? Currently this is what I have (exact copy paste from my code): -snip- This method requires XP users to check a box if they're on XP. I'd rather not dig around in the system registry, because that would require me to implement all the registry code and learn how it works and figure out what the key is and, and, and...so I was hoping there was a more reliable way. (Yes, I know Vista and 7 have a symlink to Documents called "My Documents", but I apparently can't read files from it - only write files to it)[/del] OK, I'm just retarded. I forgot it's My Games\FalloutNV.
[QUOTE=PiXeN;26779938][csharp] double[] Am = new double[9] {0, 48, 56, 1, 9, 0, 7, 9, 0}; [/csharp][/QUOTE] You don't need the 9, C# can figure it out. [editline]19th December 2010[/editline] [QUOTE=Richy19;26779450]In XNA is there anyway to make the mouse position relate to the center of the window? and not the top left corner?[/QUOTE] there's something called subtraction. you might wanna look into it
[code]#file: chaos.py #A simple program illustrating chaotic behavior. def one() print "This program illustrates a chaotic function" x = input("Enter a number between 0 and 1: ") for i in range(50): x = 3.9 * x * (1 - x) print x one() [/code] Is there any errors in this? I'm just learning python, and it says there is a syntax error.
You need a : after the def one(). Also, I would advise against including the filename as a comment. It's just redundant.
Sorry, you need to Log In to post a reply to this thread.