• What do you need help with? Version 5
    5,752 replies, posted
[code]jsoncpp-src-0.5.0\src\lib_json\json_value.cpp : fatal error C1083: Cannot open compiler generated file: '../../build/vs71/release/lib_json\json_value.asm': No such file or directory 2>LINK : fatal error LNK1257: code generation failed[/code] I'm not even trying to build jsoncpp, I'm trying to link to it what the flying fuck it also only happens on release builds [editline]31st December 2012[/editline] oh god I figured it out some gigantic retard that made the VC++ projects for it set release builds to use runtime code generation, which I dont even think works properly anymore
[QUOTE=Tobba;39036984]oh god I figured it out some gigantic retard that made the VC++ projects for it set release builds to use runtime code generation, which I dont even think works properly anymore[/QUOTE] That sounds CLI-only
[QUOTE=Tobba;39036984][code]jsoncpp-src-0.5.0\src\lib_json\json_value.cpp : fatal error C1083: Cannot open compiler generated file: '../../build/vs71/release/lib_json\json_value.asm': No such file or directory 2>LINK : fatal error LNK1257: code generation failed[/code] I'm not even trying to build jsoncpp, I'm trying to link to it what the flying fuck it also only happens on release builds [editline]31st December 2012[/editline] oh god I figured it out some gigantic retard that made the VC++ projects for it set release builds to use runtime code generation, which I dont even think works properly anymore[/QUOTE] Also, the libraries that you linked differ from debug to release. You have to configure it for each.
I'm trying to learn OpenGL on Linux from open.gl, but using [url=http://pastebin.com/kVc1bDvm]this[/url] code, it gives me error 1282 (on line 73) and the window only shows black. This is how I build it: [code] g++ -c src/untitled.cpp g++ -o bin/untitled untitled.o -lsfml-window -lsfml-system -lGLEW -lGLU -lGL [/code] Can anyone help me with this?
TileChunk.cpp [CODE]#include "TileChunk.hpp" #ifndef TILEHPP #include "Tile.hpp" #endif TileChunk::TileChunk() { Init(); } TileChunk::TileChunk(int tileOff) { Init(); tileOffset = tileOff; } void TileChunk::Init() { numberOfTiles = 0; } void TileChunk::addTile(Tile *tile, int x, int y) { tiles[x][y] = tile; } void TileChunk::removeTile(int x, int y) { if(&tiles[x][y] == NULL) { delete(&tiles[x][y]); } } int TileChunk::getOffset() { return tileOffset; } void TileChunk::setOffset(int offset) { tileOffset = offset; } void TileChunk::draw(sf::RenderTarget &target, sf::RenderStates state) const { for(int x = 0; x < CHUNKSIZE; x++) { for(int y = 0; y < CHUNKSIZE; y++) { if(&tiles[x][y] != NULL) { //tiles[x][y].sprite.setPosition(tiles[x][y].sprite.getTextureRect().width*x, CHUNKSIZE- tiles[x][y].sprite.getTextureRect().height*y); target.draw(tiles[x][y]); } } } } [/CODE] TileChunk.hpp [CODE] #ifndef TILEHPP #include "Tile.hpp" #endif #ifndef TILECHUNKHPP #define TILECHUNKHPP #define CHUNKSIZE 2048 class TileChunk : public sf::Drawable { public: TileChunk(); TileChunk(int); ~TileChunk(); void addTile(Tile, int x, int y); void removeTile(int x, int y); int getOffset(); void setOffset(int offset); Tile tiles[CHUNKSIZE][CHUNKSIZE]; private: void Init(); int tileOffset; int numberOfTiles; void draw(sf::RenderTarget&, sf::RenderStates) const; }; #endif [/CODE] C:\MinGW\projects\SfmlFun\SfmlFun\src\TileChunk.cpp||In constructor 'TileChunk::TileChunk()':| C:\MinGW\projects\SfmlFun\SfmlFun\src\TileChunk.cpp|5|error: no matching function for call to 'Tile::Tile()'| C:\MinGW\projects\SfmlFun\SfmlFun\src\Tile.hpp|10|note: candidates are: Tile::Tile(const sf::Sprite&)| C:\MinGW\projects\SfmlFun\SfmlFun\src\Tile.hpp|9|note: Tile::Tile(const sf::Texture&)| C:\MinGW\projects\SfmlFun\SfmlFun\src\Tile.hpp|6|note: Tile::Tile(const Tile&)| C:\MinGW\projects\SfmlFun\SfmlFun\src\TileChunk.cpp||In constructor 'TileChunk::TileChunk(int)':| C:\MinGW\projects\SfmlFun\SfmlFun\src\TileChunk.cpp|9|error: no matching function for call to 'Tile::Tile()'| C:\MinGW\projects\SfmlFun\SfmlFun\src\Tile.hpp|10|note: candidates are: Tile::Tile(const sf::Sprite&)| C:\MinGW\projects\SfmlFun\SfmlFun\src\Tile.hpp|9|note: Tile::Tile(const sf::Texture&)| C:\MinGW\projects\SfmlFun\SfmlFun\src\Tile.hpp|6|note: Tile::Tile(const Tile&)| C:\MinGW\projects\SfmlFun\SfmlFun\src\TileChunk.cpp|18|error: prototype for 'void TileChunk::addTile(Tile*, int, int)' does not match any in class 'TileChunk'| C:\MinGW\projects\SfmlFun\SfmlFun\src\TileChunk.hpp|15|error: candidate is: void TileChunk::addTile(Tile, int, int)| ||=== Build finished: 4 errors, 0 warnings (0 minutes, 0 seconds) ===| What the fuck... Why is it trying to call the constructor of Tile in TileChunk's constructor. I am confused as shit, been working at this for an hour. I've been playing around with headers but nothing is working :'S [editline]31st December 2012[/editline] Shit fuck fixed it... error was just blantant shit.
I'm a little new at C# - IE I've never used it before. I decompiled corneroids in an attempt to fix timeout issues (which I think i may have done), however when I come to recompile it "The type or namespace 'Lidgren' cannot be found". I went and downloaded Lidgren, but what confuses me is that it comes as a .sln solution. I compiled this, and it successfully outputs a dll which i slapped into the corneroids folder However, this doesn't fix the error and i have no idea what I'm doing from here. Does anyone have a quick, basic link or a simple explanation of what I'm doing wrong (or not at all!)?
[QUOTE=Icedshot;39046668]I'm a little new at C# - IE I've never used it before. I decompiled corneroids in an attempt to fix timeout issues (which I think i may have done), however when I come to recompile it "The type or namespace 'Lidgren' cannot be found". I went and downloaded Lidgren, but what confuses me is that it comes as a .sln solution. I compiled this, and it successfully outputs a dll which i slapped into the corneroids folder However, this doesn't fix the error and i have no idea what I'm doing from here. Does anyone have a quick, basic link or a simple explanation of what I'm doing wrong (or not at all!)?[/QUOTE] Your probably need to include the header information so that it knows how to link Lidgren.
[QUOTE=Topgamer7;39046731]Your probably need to include the header information so that it knows how to link Lidgren.[/QUOTE] Turns out you have to add a "reference" to lidgren.network, and point it towards the dll Now its complaining about a bunch of things relating to XNA, so i suspect its being pointed towards the wrong version. I'm sure i can figure it out from here, though :v:
Working on a game in LWJGL, but I am having some trouble finding out if an object is moving or not. This is the update function of the Entity class: [CODE] public void update(){ System.out.println(new Vector3f(position.x - lastPosition.x, position.y - lastPosition.y, position.z - lastPosition.z)); // SHOULD be returning some sort of difference lastPosition = position; // store the position into the last position } [/CODE] This is the update function of the Player class, which is derieved from Entity: [CODE] public void update(){ super.update(); handleInput(); // reset the matrix glLoadIdentity(); // look through the camera before you draw anything lookThrough(); // This is where translation and rotation occurs, where position is set } [/CODE] I am not sure what is wrong here, I am sure that it is some problem with the order that I am executing the code, but I have tried every order that I could. I am guessing that for some reason super.update() is getting called at the same time that the position is being set so there is no difference.
If I want to rotate a quaternion around an axis, can I just convert the angle/axis to a quaternion and multiply them? [editline]1st January 2013[/editline] [QUOTE=Duskling;39049397]Working on a game in LWJGL, but I am having some trouble finding out if an object is moving or not. This is the update function of the Entity class: [CODE] public void update(){ System.out.println(new Vector3f(position.x - lastPosition.x, position.y - lastPosition.y, position.z - lastPosition.z)); // SHOULD be returning some sort of difference lastPosition = position; // store the position into the last position } [/CODE] This is the update function of the Player class, which is derieved from Entity: [CODE] public void update(){ super.update(); handleInput(); // reset the matrix glLoadIdentity(); // look through the camera before you draw anything lookThrough(); // This is where translation and rotation occurs, where position is set } [/CODE] I am not sure what is wrong here, I am sure that it is some problem with the order that I am executing the code, but I have tried every order that I could. I am guessing that for some reason super.update() is getting called at the same time that the position is being set so there is no difference.[/QUOTE] Add velocity.
What is the type of GL_TEXTURE? I want to make a rotate function for a texture, how would I name that function? Would it be rotate(GLuint), and when I use it I would call (texturename).rotate(GL_TEXTURE0)? I know that's probably terribly wrong, I just need some pointers on how to make a texture class.
[QUOTE=Killowatt;39035315]Hi, i'm looking to implement scripting into my application, and I don't really know what to use/where to start. I'm using C# and i'd like use C# as the scripting language, but I could use something else I guess if its better.[/QUOTE] I wrote a little about my issues with .net scripting over here [URL]http://www.facepunch.com/showthread.php?t=1229762&p=38902642&viewfull=1#post38902642[/URL] You might find something in there that works for you since I basically tried everything I could find :suicide:
Can someone show me how to use glPushMatrix and glPopMatrix? I've seen them used before when creating classes to make a texture/object, but I have no idea how to use them. I want to create a simple background with a texture, and I know I'll do that by just making a rectangle the size of the screen, and projecting a texture to it. Say I wanted to make a class for it so I want my code to be neat. How would I do that?
Since you seem to have no idea what you are talking about you should follow an OpenGL tutorial. If you want to go the easy way and learn deprecated OpenGL use this: [URL]http://www.videotutorialsrock.com/[/URL] If you think you can manage the new OpenGL: [URL]http://open.gl/[/URL] For your question, push and pop matrix are used for offsetting the matrix so you don't have to move every single vertex point to the object position. If you want to draw a background square, create a function which draws a square and takes x, y, w, h as arguments. Or wrap that into a class.
No, I don't know what I'm talking about. I've been through [URL]http://opengl-tutorial.com[/URL] (till chapter 9) and [URL]http://open.gl[/URL] (until frame buffers). They didn't talk about how to do such things. But I'll try what you said. [editline]2nd January 2013[/editline] Since the square has 4 vertices, how would I just put that into a simple x, y coordinate?
I said width and height too. It looks like you're going for OpenGL > 3.2, so I can tell you how I do it: I have a shader class (which handles OpenGL shaders obviously) with a few shaders as text files. Then I have a singleton draw class which has draw.rect(x,y,w,h) as method. This function loads and/or activates the rect2d shader (which draws 2D rects, obviously. If you want the source, ask). Then it passes all uniforms like screen size (which are sent to the draw class when the window is resized) , scale and position to the shader, finally drawing a vertex array object which holds a square of size 1, 1 which is at position 0. [editline]2nd January 2013[/editline] If you want a textured version of that, I suggest creating a Texture class which holds the GL texture id which you can pass to this function. Simply call glActiveTexture(tex.id) and so on in the function, then. Or make that a member function, like tex.activate(). It could also have functions for opening the texture file and loading it into OpenGL.
I already have a shader class. I didn't know a shader could draw something. Could I have the code?
What else for do you use shaders? [editline]2nd January 2013[/editline] fragment.fp [code] #version 130 uniform sampler2D Image; uniform vec4 Color; out vec4 vFragColor; smooth in vec2 vVaryingTexCoord; void main(void){ vec4 color = texture(Image, vVaryingTexCoord); if(color.a < 0.01) discard; vFragColor = color * Color; } [/code] vertex.vp [code] #version 130 in vec4 vVertex; in vec2 vTexture0; uniform vec3 Screen; uniform vec3 Offset; uniform vec3 Scale; smooth out vec2 vVaryingTexCoord; void main(void){ vVaryingTexCoord = vTexture0.st; vec4 t = vVertex; t.x = (vVertex.x*Scale.x + Offset.x) / Screen.x * 2 - 1; t.y = (vVertex.y*Scale.y + Offset.y) / Screen.y * 2 - 1; gl_Position = t; } [/code]
[QUOTE=WeltEnSTurm;39069399]What else for do you use shaders?[/QUOTE] I thought it just handled the vertexes and the pixels. Or lighting. I've made a diffuse lighting shader. [editline]2nd January 2013[/editline] Oh I get what you mean now with width and height. You just need one x, y point, and then you can make the whole rectangle from extending that point into a lines corresponding to width and height.
[QUOTE=Meatpuppet;39069123]No, I don't know what I'm talking about. I've been through [URL]http://opengl-tutorial.com[/URL] (till chapter 9) and [URL]http://open.gl[/URL] (until frame buffers). They didn't talk about how to do such things. But I'll try what you said. [editline]2nd January 2013[/editline] Since the square has 4 vertices, how would I just put that into a simple x, y coordinate?[/QUOTE] The reason those resources don't cover that is because glPush/PopMatrix are decrepated.
[QUOTE=ArgvCompany;39069762]The reason those resources don't cover that is because glPush/PopMatrix are decrepated.[/QUOTE] Then how would I manage to do the same thing but in modern openGL?
[QUOTE=Meatpuppet;39069823]Then how would I manage to do the same thing but in modern openGL?[/QUOTE] You use shaders as explained by WeltEnSTurm.
[QUOTE=ArgvCompany;39069844]You use shaders as explained by WeltEnSTurm.[/QUOTE] So what you're saying is to just use different shader programs when drawing different things?
Is there any particular reason why the stack is executable by default on Windows?
[QUOTE=WeltEnSTurm;39069399]What else for do you use shaders? [editline]2nd January 2013[/editline] fragment.fp [code] #version 130 uniform sampler2D Image; uniform vec4 Color; out vec4 vFragColor; smooth in vec2 vVaryingTexCoord; void main(void){ vec4 color = texture(Image, vVaryingTexCoord); if(color.a < 0.01) discard; vFragColor = color * Color; } [/code] vertex.vp [code] #version 130 in vec4 vVertex; in vec2 vTexture0; uniform vec3 Screen; uniform vec3 Offset; uniform vec3 Scale; smooth out vec2 vVaryingTexCoord; void main(void){ vVaryingTexCoord = vTexture0.st; vec4 t = vVertex; t.x = (vVertex.x*Scale.x + Offset.x) / Screen.x * 2 - 1; t.y = (vVertex.y*Scale.y + Offset.y) / Screen.y * 2 - 1; gl_Position = t; } [/code][/QUOTE] How did you come up with these shaders? Also what does smooth mean, like in smooth in/out? Also what is discard? [editline]2nd January 2013[/editline] I thought shaders were just for telling the gpu how to put something on the screen, not to actually draw it.
[QUOTE=Meatpuppet;39071270]How did you come up with these shaders? Also what does smooth mean, like in smooth in/out? Also what is discard? [editline]2nd January 2013[/editline] I thought shaders were just for telling the gpu how to put something on the screen, not to actually draw it.[/QUOTE] I read good tutorials. Also, I have the OpenGL SuperBible. Smooth means a value is smoothened between vertices. For instance if a polygon has different light levels for each polygon and you want them to mix in the pixel stage you use that. Discard skips the current element, for instance you don't need to draw stuff with alpha 0. It also doesn't write it to the depth buffer. Shaders are programs on the GPU, you can do a lot of stuff with them. In this case they just take a few global variables and draw a very simple array. For each vertex in your VAO the vertex shader is run, after that for each pixel the fragment shader is run.
[QUOTE=WeltEnSTurm;39072187]I read good tutorials. Also, I have the OpenGL SuperBible. Smooth means a value is smoothened between vertices. For instance if a polygon has different light levels for each polygon and you want them to mix in the pixel stage you use that. Discard skips the current element, for instance you don't need to draw stuff with alpha 0. It also doesn't write it to the depth buffer. Shaders are programs on the GPU, you can do a lot of stuff with them. In this case they just take a few global variables and draw a very simple array. For each vertex in your VAO the vertex shader is run, after that for each pixel the fragment shader is run.[/QUOTE] That book looks pretty good, the superbible. I honestly think that I should stop going through tutorials now, because it seems like I can't ever actually make anything at all, I cry sometimes because I feel like I'll never make anything and that I've wasted my time on those tutorials. I just need to focus on actually making something, and that's why I made a thread in here called tell me what to program. The reason I came in here is because I just wanted to learn how to make a background, and I still don't know how, and you're probably really annoyed at me and think I'm stupid, so I'm sorry.
Well here I am, after reading through many pointer and bitmap tutorials, still fighting with this problem i have been having for hours. The problem is, I want to create a bitmap file. After some fiddling, I have a working header and it all works. But now I came across the problem, that I need to be able to create an array of length which must be defined during runtime. No problem, pointers. Or so I thought. In the header part of a bitmap file, the size must be specified. Which means I need to change individual bytes of the char pointer. Should be simple and I feel pretty stupid for struggling with this. I would be greatful if somebody could help me out here: [code] #include <iostream> #include <fstream> using namespace std; unsigned int width = 400; unsigned int height = 400; int datasize = width * height * 4; int main() { fstream file("test.bmp", fstream::out | ios::binary); char * header; header = new char [56]; header = "BM" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x36\x00\x00\x00" "\x28\x00\x00\x00" "\x10\x00\x00\x00" "\x00\x00\x00\x00" "\x01\x00" "\x20\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00"; char* hexwidth; hexwidth = new char [10]; sprintf(hexwidth, "%X", width % 256); cout << hexwidth; header[18] = *hexwidth; sprintf(hexwidth, "%X", width / 256); cout << hexwidth << "\n"; header[19] = *hexwidth; sprintf(hexwidth, "%X", height % 256); cout << hexwidth; header[22] = *hexwidth; sprintf(hexwidth, "%X", height / 256); cout << hexwidth; header[23] = *hexwidth; char * data; data = new char [datasize]; file.write(header, 56); delete[] header; file.write(data, datasize); delete[] data; file.close(); } [/code] the problem comes here : header[18] = *hexwidth; Unfortuanatelly, the error message is in German; here is a loose translation : "Access violation while writing at Position 0xblahblahblah"
[QUOTE=freakadella;39072900] the problem comes here : header[18] = *hexwidth; Unfortuanatelly, the error message is in German; here is a loose translation : "Access violation while writing at Position 0xblahblahblah"[/QUOTE] You should allocate memory for hexwidth with either malloc() or new (in which case it would be a string not a char * I think) before sprintf'ing to it.
[QUOTE=freakadella;39072900]Well here I am, after reading through many pointer and bitmap tutorials, still fighting with this problem i have been having for hours. The problem is, I want to create a bitmap file. After some fiddling, I have a working header and it all works. But now I came across the problem, that I need to be able to create an array of length which must be defined during runtime. No problem, pointers. Or so I thought. In the header part of a bitmap file, the size must be specified. Which means I need to change individual bytes of the char pointer. Should be simple and I feel pretty stupid for struggling with this. I would be greatful if somebody could help me out here: [code] #include <iostream> #include <fstream> using namespace std; unsigned int width = 400; unsigned int height = 400; int datasize = width * height * 4; int main() { fstream file("test.bmp", fstream::out | ios::binary); char * header; header = new char [56]; header = "BM" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x36\x00\x00\x00" "\x28\x00\x00\x00" "\x10\x00\x00\x00" "\x00\x00\x00\x00" "\x01\x00" "\x20\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\x00\x00"; char* hexwidth; hexwidth = new char [10]; sprintf(hexwidth, "%X", width % 256); cout << hexwidth; header[18] = *hexwidth; sprintf(hexwidth, "%X", width / 256); cout << hexwidth << "\n"; header[19] = *hexwidth; sprintf(hexwidth, "%X", height % 256); cout << hexwidth; header[22] = *hexwidth; sprintf(hexwidth, "%X", height / 256); cout << hexwidth; header[23] = *hexwidth; char * data; data = new char [datasize]; file.write(header, 56); delete[] header; file.write(data, datasize); delete[] data; file.close(); } [/code] the problem comes here : header[18] = *hexwidth; Unfortuanatelly, the error message is in German; here is a loose translation : "Access violation while writing at Position 0xblahblahblah"[/QUOTE] You're attempting to set a char to a dereferenced char array.
Sorry, you need to Log In to post a reply to this thread.