• What do you need help with? Version 5
    5,752 replies, posted
Using C++ and directx, What would be the best method of loading in a shader and then giving it to different entities? The method I have right now works but If i attempt to change a variable in one of the entities, the same variable changes on the other entities.
[QUOTE=Umbra Fidelis;36807426]Anyone know any good software for planning code? You know like class diagrams n' shit. Would be great if you knew some.[/QUOTE] Visio is reasonable for class diagrams
I'm trying to multiply the value of my chronometer or just try to get the value to be a string. Every time I try to make it a string and use toast.show() to view it, my application crashes. I can get the value of my EditText to show up but I can't seem to get my chronometer to work. Both the strings time and fin make it crash. Here's the code: [code]String hour = String.valueOf(mText.getText()); String time = String.valueOf(mChronometer.getBase() - stoppedMilliseconds); int h = java.lang.Integer.parseInt(hour) / 60; int t = java.lang.Integer.parseInt(time) * 1000 / 60; int mm = h * t; mon.setText(Integer.toString(mm)); String fin = "" + mm; Toast.makeText(PoopActivity.this, "Money made: " + fin, Toast.LENGTH_LONG).show();[/code]
_ snip _ Dammit how do I un-snip? :(
[QUOTE=Umbra Fidelis;36807426]Anyone know any good software for planning code? You know like class diagrams n' shit. Would be great if you knew some.[/QUOTE] Dia
[QUOTE=Umbra Fidelis;36807426]Anyone know any good software for planning code? You know like class diagrams n' shit. Would be great if you knew some.[/QUOTE] I would say paint. I have tried dozens of programs and all of them are hard to make diagrams as you want them. Someday I might make my own program. [QUOTE=Richy19;36812197]Dia[/QUOTE] Maybe I am dumb, but I find it a bit hard to use. It is still one of the best programs that you can use for this. [QUOTE=Rifle;36810397]I'm trying to multiply the value of my chronometer or just try to get the value to be a string. Every time I try to make it a string and use toast.show() to view it, my application crashes. I can get the value of my EditText to show up but I can't seem to get my chronometer to work. Both the strings time and fin make it crash. Here's the code: [code]String hour = String.valueOf(mText.getText()); String time = String.valueOf(mChronometer.getBase() - stoppedMilliseconds); int h = java.lang.Integer.parseInt(hour) / 60; int t = java.lang.Integer.parseInt(time) * 1000 / 60; int mm = h * t; mon.setText(Integer.toString(mm)); String fin = "" + mm; Toast.makeText(PoopActivity.this, "Money made: " + fin, Toast.LENGTH_LONG).show();[/code][/QUOTE] Are you sure, looks like mon is the reason for it to crash. If mon is null, you cannot call setText.
[QUOTE=AlienCat;36812014]_ snip _ Dammit how do I un-snip? :([/QUOTE] Press your name here: [img]http://new.tinygrab.com/7cfbd51783b9e860c66bc3c5d3457065d6d5f808a4.png[/img]
[QUOTE=Darkwater124;36812310]Trying out, hold on...[/QUOTE] That feel when you first think all is good. Then waait there is more pages, I am writing irrelevant stuff! And then, oh, I was on the last page. [editline]17th July 2012[/editline] [QUOTE=Loli;36787555]I've been working on a "BIT.TRIP BEAT" Clone and was wondering... How would you guys save the file. Essentially I need to store - Location - Speed - Note (A, Ab, D# etc.)[/QUOTE] Save each on its own line. [del]Or make a struct and... save the struct.[/del] Don't. [editline]17th July 2012[/editline] [QUOTE=Darkwater124;36812310]Press your name here: [img]http://new.tinygrab.com/7cfbd51783b9e860c66bc3c5d3457065d6d5f808a4.png[/img][/QUOTE] Wow! thank you! I never learn what the words "hold on" means tho.
[QUOTE=AlienCat;36812348]Save each on its own line. Or make a struct and... save the struct.[/QUOTE] Writing raw structs into files only makes sense if they're never going to change and even in that case you should serialise them.
Thats right, just dumb of me to suggest that. Anyone know something about qt3d? I can't for my life get rid of the culling or whatever it is called. When zooming towards a object, it got like eated by a black border. setNearPlane does not help. Here is some code: [CODE]void simulationRenderer::initializeGL(QGLPainter *painter) { QGLCamera* cam = new QGLCamera(); cam->setNearPlane(1); cam->setFarPlane(1000); painter->setCamera(cam); [/CODE] Here is how the shit looks: [IMG]http://i.imgur.com/mXLrK.png[/IMG]
Anyone here good with the HL2 source? In gameinterface.cpp, as soon as I do: #include <SerialClass.h> I get these warnings/errors: [code]1> gameinterface.cpp 1>c:\program files\microsoft sdks\windows\v7.0a\include\winbase.h(59): warning C4005: 'INVALID_HANDLE_VALUE' : macro redefinition 1> d:\new folder\mymod\src\common\xbox\xboxstubs.h(97) : see previous definition of 'INVALID_HANDLE_VALUE' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winbase.h(7558): warning C4005: 'GetCommandLine' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(185) : see previous definition of 'GetCommandLine' 1>c:\program files\microsoft sdks\windows\v7.0a\include\wincon.h(328): warning C4005: 'ReadConsoleInput' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(251) : see previous definition of 'ReadConsoleInput' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(290): warning C4005: 'RegCreateKey' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(233) : see previous definition of 'RegCreateKey' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(324): warning C4005: 'RegCreateKeyEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(227) : see previous definition of 'RegCreateKeyEx' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(636): warning C4005: 'RegOpenKey' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(197) : see previous definition of 'RegOpenKey' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(662): warning C4005: 'RegOpenKeyEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(191) : see previous definition of 'RegOpenKeyEx' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(756): warning C4005: 'RegQueryValue' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(221) : see previous definition of 'RegQueryValue' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(813): warning C4005: 'RegQueryValueEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(215) : see previous definition of 'RegQueryValueEx' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(929): warning C4005: 'RegSetValue' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(209) : see previous definition of 'RegSetValue' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(958): warning C4005: 'RegSetValueEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(203) : see previous definition of 'RegSetValueEx' 1>d:\new folder\mymod\src\game\server\gameinterface.cpp(808): error C2039: 'CreateEventA' : is not a member of 'IGameEventManager2' 1> d:\new folder\mymod\src\public\igameevents.h(98) : see declaration of 'IGameEventManager2'[/code] SerialClass.h, SerialClass.cpp are from here: [url]http://arduino.cc/playground/Interfacing/CPPWindows[/url] Any ideas?
[QUOTE=Chrispy_645;36818094]Anyone here good with the HL2 source? In gameinterface.cpp, as soon as I do: #include <SerialClass.h> I get these warnings/errors: [code]1> gameinterface.cpp 1>c:\program files\microsoft sdks\windows\v7.0a\include\winbase.h(59): warning C4005: 'INVALID_HANDLE_VALUE' : macro redefinition 1> d:\new folder\mymod\src\common\xbox\xboxstubs.h(97) : see previous definition of 'INVALID_HANDLE_VALUE' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winbase.h(7558): warning C4005: 'GetCommandLine' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(185) : see previous definition of 'GetCommandLine' 1>c:\program files\microsoft sdks\windows\v7.0a\include\wincon.h(328): warning C4005: 'ReadConsoleInput' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(251) : see previous definition of 'ReadConsoleInput' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(290): warning C4005: 'RegCreateKey' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(233) : see previous definition of 'RegCreateKey' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(324): warning C4005: 'RegCreateKeyEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(227) : see previous definition of 'RegCreateKeyEx' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(636): warning C4005: 'RegOpenKey' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(197) : see previous definition of 'RegOpenKey' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(662): warning C4005: 'RegOpenKeyEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(191) : see previous definition of 'RegOpenKeyEx' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(756): warning C4005: 'RegQueryValue' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(221) : see previous definition of 'RegQueryValue' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(813): warning C4005: 'RegQueryValueEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(215) : see previous definition of 'RegQueryValueEx' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(929): warning C4005: 'RegSetValue' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(209) : see previous definition of 'RegSetValue' 1>c:\program files\microsoft sdks\windows\v7.0a\include\winreg.h(958): warning C4005: 'RegSetValueEx' : macro redefinition 1> d:\new folder\mymod\src\public\tier0\protected_things.h(203) : see previous definition of 'RegSetValueEx' 1>d:\new folder\mymod\src\game\server\gameinterface.cpp(808): error C2039: 'CreateEventA' : is not a member of 'IGameEventManager2' 1> d:\new folder\mymod\src\public\igameevents.h(98) : see declaration of 'IGameEventManager2'[/code] SerialClass.h, SerialClass.cpp are from here: [url]http://arduino.cc/playground/Interfacing/CPPWindows[/url] Any ideas?[/QUOTE] [code]#include <windows.h> #include <stdio.h> #include <stdlib.h>[/code] Including these in mod-code is probably fucking it up. Try including those in SerialClass.cpp instead of SerialClass.h
That ends up giving this since the header file doesn't know what I'm talking about: [code]1>d:\new folder\mymod\src\game\server\serialclass.h(14): error C2146: syntax error : missing ';' before identifier 'status' 1>d:\new folder\mymod\src\game\server\serialclass.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\new folder\mymod\src\game\server\serialclass.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\new folder\mymod\src\game\server\serialclass.h(16): error C2146: syntax error : missing ';' before identifier 'errors' 1>d:\new folder\mymod\src\game\server\serialclass.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\new folder\mymod\src\game\server\serialclass.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int[/code] I know this probably doesn't mean shit but I thought including those (windows.h, stdio, stdlib) would be fine since I've seen all 3 of those #includes in other parts of the HL2 code.
[QUOTE=Chrispy_645;36818809]That ends up giving this since the header file doesn't know what I'm talking about: [code]1>d:\new folder\mymod\src\game\server\serialclass.h(14): error C2146: syntax error : missing ';' before identifier 'status' 1>d:\new folder\mymod\src\game\server\serialclass.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\new folder\mymod\src\game\server\serialclass.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\new folder\mymod\src\game\server\serialclass.h(16): error C2146: syntax error : missing ';' before identifier 'errors' 1>d:\new folder\mymod\src\game\server\serialclass.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\new folder\mymod\src\game\server\serialclass.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int[/code] I know this probably doesn't mean shit but I thought including those (windows.h, stdio, stdlib) would be fine since I've seen all 3 of those #includes in other parts of the HL2 code.[/QUOTE] Oops. I didn't read through the .h file very well. You can try forward declaring those classes, but don't think it'll work.
I have a programming repeat coming up and I really need to pass it. Here is the material we covered this year: [url]http://www.computing.dcu.ie/~jmorris/ca213/indexLect.html[/url] Anybody have any good resources for learning this sort of stuff? Programming isn't my strongest subject, as much as I wish it was and would love to learn all this stuff
The best way is practice really. You can look stuff up by just searching on them and try out the stuff by yourself.
I'm making a java applet that should connect to a MySQL database. It works perfectly when I run the applet locally in a browser. but once I upload it to the ftp server to run it, it can't connect to the database. No exceptions, no nothing. Just a non-responding applet. I have digitally self signed the applet. [cpp] public static void initConnection(Settings info) throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); //Freezes on next line. Connection conn = DriverManager.getConnection("jdbc:mysql://" + info.getHost() + ":3306/" + info.getDbName(), info.getUser(), info.getPass()); stmt = conn.createStatement(); } [/cpp]
[QUOTE=Ehmmett;36850512]Just messing about with standalone lua. I've got a .bat that runs the .lua file in 'interactive mode'. How do i go about stopping it from closing when there's an error. Makes debugging one hell of a process.[/QUOTE] Put pause at the end of the .bat?
Alternatively, just run the batch file from a command prompt in the first place.
Trying to optimize my bloom effect. I currently have: Window 1024x576, FBO1 1024x576, FBO2 1024x576, displayImage 1024x576, [cpp] #version 120 varying vec2 uv; uniform sampler2D Texture; const float rt_w = 1024; // render target width const float rt_h = 576; // render target height const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); const int iter = 3; void main() { vec4 tc = texture2D(Texture, uv).rgba * weight[0]; for (int i=1; i<iter; i++) { tc += texture2D(Texture, uv + vec2(0.0, offset[i])/rt_h).rgba * weight[i]; tc += texture2D(Texture, uv - vec2(0.0, offset[i])/rt_h).rgba * weight[i]; } gl_FragColor = tc; } [/cpp] [cpp] #version 120 varying vec2 uv; uniform sampler2D Texture; const float rt_w = 1024; // render target width const float rt_h = 576; // render target height const int iter = 3; const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); void main() { vec4 tc = texture2D(Texture, uv).rgba * weight[0]; for (int i=1; i<iter; i++) { tc += texture2D(Texture, uv + vec2(offset[i])/rt_w, 0.0).rgba * weight[i]; tc += texture2D(Texture, uv - vec2(offset[i])/rt_w, 0.0).rgba * weight[i]; } gl_FragColor = tc; } [/cpp] Notice the rt_w & rt_h variables there. and I: Draw things to the window, Draw things that need blooming to FBO1 with normal shader. Draw FBO1 to FBO2 using the first shader. Draw FBO2 to window using second shader. So my idea was to reduce the size of the FBO's by 4 giving me FBO's of size 256x144 but when I use the same code but simply reducing the FBO size doesnt draw it, can someone help me out with what values the FBO's, Perspective & Ortho matrixes and displayImage's should use in terms of height and width?
I thought you were supposed to render your scene out to the Backbuffer/a Texture2D, downsize it in steps (halving each time until it's a certain size), apply a gaussian blur to the downsampled image, then upscale that and apply it over the original backbuffer with certain blending modes. [b]Edit:[/b] My implementation sounds like cheap bloom.
Yea thaats what im trying to do but i cant get my head around the matrices & coordinates
Having problems with GLuint and GLint with C++/OpenGL. Just getting errors like, GLuint was not declared in this scope GLint was not declared in this scope Everything else is working perfectly and when I replace GLuint and GLint with unsigned int and int then my program runs (it doesn't work properly but I assume that's something to do with my vertex and fragment shader code being fucked up.) Am I missing some prerequisite library?
did you include gl.h?
I'm making a 2D side scroller in XNA as my first ever project and I've fallen at the first hurdle. I'd like to make maps in a neat fashion so I can also place crates and buildings on them, however the only way I have been managing to do this is by giving eat block a value (ei 1 = block 0 = air) and filling in a grid, which works to an extent, but its nothing pretty and I can't place anything else on it. [code] [0],[0],[0] [0],[0],[0] [1],[1],[1][/code]
[QUOTE=FreddiRox!;36872191]I'm making a 2D side scroller in XNA as my first ever project and I've fallen at the first hurdle. I'd like to make maps in a neat fashion so I can also place crates and buildings on them, however the only way I have been managing to do this is by giving eat block a value (ei 1 = block 0 = air) and filling in a grid, which works to an extent, but its nothing pretty and I can't place anything else on it. [code] [0],[0],[0] [0],[0],[0] [1],[1],[1][/code][/QUOTE] Congratulations, you're making a tile-based game. For objects that you can move around / shoot at / are dynamic in any other way I'd recommend making an additional array for them with x and y values. If they're just static, use other numbers, like 0 = air, 1 = dirt, 2 = crate, 3 = building-left wall, 4 = building-right wall, 5 = building-top wall etc.
OK, so lets say I still want to make a 2D side scroller, how else could I make the maps for the levels?
Would this: [cpp] bool t = inputs[0]->getConnection()->output(); for(int i = 1; i < inputs.size(); i++) { if(!inputs[i]->getInverted()) { t = t && inputs[i]->getConnection()->output(); } else { t = t && !inputs[i]->getConnection()->output(); } } if(t) { return true; } else { return false; } [/cpp] work for getting a correct output from an AND gate with 2-Many inputs, which any one of them can be inverted? [cpp] inputs[i]->getConnection()->output(); [/cpp] is used for getting the output of another gate. For testing I have two types of non-standard gates: GateType::HIGH and GateType::LOW. These output true and false respectively.
I'm analyzing the source code for a DOS game, specifically, [url=https://github.com/id-Software/wolf3d/tree/master/WOLFSRC]Wolfenstein 3D[/url]. It keeps referring to "tics" as a unit of time. DOS does time to a resolution of 1 centisecond, apparently. Is it a good bet that's it? I don't know shit about C++.
[QUOTE=Elecbullet;36876474]I'm analyzing the source code for a DOS game, specifically, [url=https://github.com/id-Software/wolf3d/tree/master/WOLFSRC]Wolfenstein 3D[/url]. It keeps referring to "tics" as a unit of time. DOS does time to a resolution of 1 centisecond, apparently. Is it a good bet that's it? I don't know shit about C++.[/QUOTE] One tick generally seems to refer to one time a certain game loop is run.
Sorry, you need to Log In to post a reply to this thread.