[QUOTE=windwakr;37913651][url=http://flatassembler.net/]FASM[/url] is good.[/QUOTE]
Thanks, but i still need some help getting started..
Guide says i need to compile using fasm.exe, but that just starts for a short moment, then it closes again. Internet says to use fasmw.exe, but that gives me other problems, since i used some example script which was supposed to output a letter, but i never got that output.
damn this is annoying
[QUOTE=.apex;37922766]Thanks, but i still need some help getting started..
Guide says i need to compile using fasm.exe, but that just starts for a short moment, then it closes again. Internet says to use fasmw.exe, but that gives me other problems, since i used some example script which was supposed to output a letter, but i never got that output.
damn this is annoying[/QUOTE]
Don't double click it. Run it in cmd.
[QUOTE=xThaWolfx;37920330]In OpenGL, if I have two shaders, a lighting and a texturing shader for example, how would I go about combining the output of those 2 shaders?
And I'm not talking about merging the code into a single shader, I actually want to keep those shaders seperated.
A small example:
[thumb]http://puu.sh/1bBO1[/thumb]
As you can see I've got the lighting rendered in the main view, and the textures are rendered in the smaller viewport. I wish to combine these two into a single view having both textures and lighting.
I'd appreciate any help![/QUOTE]
Seeing as you're able to draw both the diffuse and lighting I'm assuming you have them both as textures? Just have both of them as texture samplers and do a fullscreen pass combining them both.
This seems obvious though, I'm not sure what you're doing for it not to be.
I have a feeling you're drawing everything twice - which you really should not be wanting to do.
So i've been coding C++ for couple days, and now i want to code a simple chat program, to message between 2 computers. (Server and Client) I'm thinking of using sockets, but i have no idea where to start from.
Are there any 'chat' tutorials for C++ sockets?
Does anyone else know of any straight forward png encoding libraries, they have to work in memory. I'm currently using miniz, but it's a little slow. All it is is calling one function, and then freeing the memory which ideal from a developer perspective (at least in this circumstance).
libpng is quite straightforward for encoding. I tried DevIL once but it would silently fail with some bad PNGs, couldn't use memory as efficiently as I would've wanted and wasn't significantly easier than just uing libpng
libpng doesn't really work for me, I can't work out how I can get it to spit out the result to memory rather than a file. The only example I found on overriding the write function refused to work, so I just used miniz.
[QUOTE=windwakr;37923973]Can you post it?[/QUOTE]
[code]mov ah,2
mov dl,97
int 21h
int 20h
[/code]
Its from the downloadable tutorial off the website, it says its for DOS, but the tutorial says it'll work on Windows aswell (which it havnt so far, now im getting stuck at compitability errors)
in the end its probably just me being incredibly dumb somewhere
Ok so I learned how to draw two sprites at once:
[cpp] if (d3ddev->BeginScene())
{
spriteobj->Begin(D3DXSPRITE_ALPHABLEND);
Sprite_Animate(frame, 0, 29, 1, starttime, 30);
Sprite_Draw_Frame(explosion, 200, 200, frame, 128, 128, 6);
Sprite_Draw_Frame(explosion, 500, 500, frame, 128, 128, 6);
//stop rendering
spriteobj->End();
d3ddev->EndScene();
d3ddev->Present(NULL, NULL, NULL, NULL);
}
[/cpp]
but I still don't know how to give each of them different, independent animation rates. Help?
[QUOTE=ben1066;37926176]libpng doesn't really work for me, I can't work out how I can get it to spit out the result to memory rather than a file. The only example I found on overriding the write function refused to work, so I just used miniz.[/QUOTE]
Though I'd rather suggest you try to get it working correctly, it's possible to hack your way around this by e.g. creating a memory-mapped file and just passing the file handle to libpng normally. This is easier on Linux, where there are functions (fmemopen et al.) that do exactly this, but shouldn't take too long on Windows either.
-snip- got it!
[QUOTE=laylay;37924322]Seeing as you're able to draw both the diffuse and lighting I'm assuming you have them both as textures? Just have both of them as texture samplers and do a fullscreen pass combining them both.
This seems obvious though, I'm not sure what you're doing for it not to be.
I have a feeling you're drawing everything twice - which you really should not be wanting to do.[/QUOTE]
How would you draw the scene twice (for each effect) without actually drawing twice?
[QUOTE=Richy19;37928435]How would you draw the scene twice (for each effect) without actually drawing twice?[/QUOTE]
Well you can't if you want to draw the scene with 2 different shaders but I'm not sure why he'd want to do that. If he's wanting to do deferred lighting then you just output each frag colour to each colour attachment of your MRT.
I'm a bit confused as to what he's trying to do though. If he's doing deferred lighting then he should have access to the texture samplers he needs.
Quick question with math I guess.
I need to program a program that tells you how many shapes you can make with the given number of blocks. As in if you have 8 blocks you can have 3 shapes (No random ones) I don't know how to call it in english math god damn it. Anyhoo 3 shapes if you lay them down side by side. Place 4 and 4 on top or a square of behind a square of 4 blocks.
[QUOTE=RapistSanta;37933931]Quick question with math I guess.
I need to program a program that tells you how many shapes you can make with the given number of blocks. As in if you have 8 blocks you can have 3 shapes (No random ones) I don't know how to call it in english math god damn it. Anyhoo 3 shapes if you lay them down side by side. Place 4 and 4 on top or a square of behind a square of 4 blocks.[/QUOTE]
I do not understand the question.
I think he means how many cuboid shapes he can make....
- Snip, rewrote the whole thing. -
How can you give two sprites different, independent animation rates?
I've figured out how to give them each different rates, but they all restart at the same time so one might not finish.
How do I get VS 2012 to auto delete the massive *.sdf file in a way similar to "clean solution"? Manually deleting it just feels stupid.
Also, how do I get "clean solution" to not delete my *.exe?
One more thing. How do you get an *.exe to use *.dll's that are outside the same location as the *.exe? I do know the *.dll's should really only be in one place, or at least only be in places defined by the *.exe (I think?) or variables like %PATH%.
[QUOTE=elevate;37937128]How do I get VS 2012 to auto delete the massive *.sdf file in a way similar to "clean solution"? Manually deleting it just feels stupid.
Also, how do I get "clean solution" to not delete my *.exe?[/QUOTE]
For the first, no idea. For the second you can add a post build step to copy the file to another dir, however it won't start using that one unless you change the debug target too. Still a bit of a hack.
Alright, last one then I'm done for a while. I keep getting this error:
[code]error C2664: cannot convert parameter 2 from 'std::string' to 'std::string []'[/code]
for this line:
[code]calcScore(ootpoot, names[i], s1, s2, s3, s4, s5);[/code]
in:
[code]
/* STARSEARCH.CPP - Source
* STARSEARCH.DAT - Input
* RESULTS.DAT - Output
*
* We'll be using the sample from the
* instructions as input. */
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// Takes the file object as ref. parameter, reads the file for a name, and return it. Called by main per line of input.
string contestantName(ifstream&);
// Gets the judge score and validates it. Five times per contestant and called per score.
void getJudgeData(float&);
// Calculate the score by dropping the highest and lowest and averaging the remaining three. This will write to file.
void calcScore(ofstream&, string [], float, float, float, float, float);
// Find the lowest of the five scores passed to it. Called by calcScore.
float findLowest(float, float, float, float, float);
// Find the highest of the five scores passed to it. Called by calcScore.
float findHighest(float, float, float, float, float);
int main() {
cout << "Star Search by Stonecycle\n\n";
int contestants; // Contestants
float s1, s2, s3, s4, s5; // Scores to write to
string names[100]; // In case there's more names, we got to save them.
ifstream roster; // Input object
ofstream ootpoot; // Output object
roster.open("starsearch.dat"); // Open STARSEARCH.DAT
roster >> contestants; // Read the amount of times to execute (contestant count).
cout << "Reading from STARSEARCH.DAT...\n";
cout << contestants << " contestants.\n\n"; // "X contestants."
for (int i = 0; i < contestants; i++) {
names[i] = contestantName(roster);
cout << "Contestant #" << i+1 << ": " << names[i] << endl << "Scores: ";
roster >> s1 >> s2 >> s3 >> s4 >> s5;
getJudgeData(s1); getJudgeData(s2); getJudgeData(s3); getJudgeData(s4); getJudgeData(s5); cout << endl;
calcScore(ootpoot, names[i], s1, s2, s3, s4, s5);
cout << endl << endl;
}
system("pause");
return 0;
}
// This either feels redundant or I'm not doing something right. Bet on the latter.
string contestantName(ifstream &file) {
string name;
file >> name;
return name;
}
// Gets the judge score and validates it. Five times per contestant and called per score.
void getJudgeData(float &score) {
if (score < 0 || score > 10) {
cerr << "\aSCORE NOT VALID (MUST BE BETWEEN 0 AND 10).\nPROGRAM WILL TERMINATE.\nADJUST VALUES IN STARSEARCH.DAT.\n\n";
system("pause");
exit(0); }
else
cout << score << ", ";
}
// Calculate the score by dropping the highest and lowest and averaging the remaining three. This will write to file.
void calcScore(ofstream &output, string name [], float s1, float s2, float s3, float s4, float s5) {
output.open("results.dat"); // PREPARE SHIP FOR OUTPUT FILE VOODOO!
float total = s1 + s2 + s3 + s4 + s5; // Why are you preparing? You're always preparing. Just go.
float low = findLowest(s1, s2, s3, s4, s5);
float high = findHighest(s1, s2, s3, s4, s5);
total -= (low + high); // Just go.
printf("Tally: %.2f", total / 3);
output << "Name\tTally\n";
output << name << "\t" << total / 3 << endl;
}
// Find the lowest of the five scores passed to it. Called by calcScore.
float findLowest(float s1, float s2, float s3, float s4, float s5) {
if (s1 < s2)
return s1;
if (s2 < s3)
return s2;
if (s3 < s4)
return s3;
if (s4 < s5)
return s4;
else
return s5; }
float findHighest(float s1, float s2, float s3, float s4, float s5) {
if (s1 > s2)
return s1;
if (s2 > s3)
return s2;
if (s3 > s4)
return s3;
if (s4 > s5)
return s4;
else
return s5; }[/code]
starsearch.dat
[code]2
Jennifer 10 9 8 9.5 10
Michael 10 9 10 9 10[/code]
Few questions. A) What exactly is this error message meaning? I guess something about going from string to string [], and B) How does this get fixed? Spent the last two hours searching for a remedy.
[cpp]void calcScore(ofstream &output, string name [],[/cpp]
should be
[cpp]void calcScore(ofstream &output, string name[][/cpp]
I think.
[editline]6th October 2012[/editline]
Or you could do a character array (char strarray[]) I think.
[QUOTE=Meatpuppet;37940040][cpp]void calcScore(ofstream &output, string name [],[/cpp]
should be
[cpp]void calcScore(ofstream &output, string name[][/cpp]
I think.
[editline]6th October 2012[/editline]
Or you could do a character array (char strarray[]) I think.[/QUOTE]
Removing the space between the brackets and the name doesn't affect it, as the results are the exact same. A character array? Not exactly wanting to make this any tougher than it is.
I can tell you why you're getting the error; it's because in the definition of the function
[cpp]void calcScore(ofstream &output, string name [], float s1, float s2, float s3, float s4, float s5)[/cpp]
string name [] is not matching up with
[cpp]calcScore(ootpoot, names[i], s1, s2, s3, s4, s5);[/cpp]
names[i]
[editline]7th October 2012[/editline]
Wait, I think it could be
[cpp]
void calcScore(ofstream &output, string[] name, float s1, float s2, float s3, float s4, float s5)[/cpp]
and when you declare and define 'names', it should be
[cpp]string[100] names;[/cpp]
Try that. I'm just guessing though.
[QUOTE=Meatpuppet;37940140]I can tell you why you're getting the error; it's because in the definition of the function
[cpp]void calcScore(ofstream &output, string name [], float s1, float s2, float s3, float s4, float s5)[/cpp]
string name [] is not matching up with
[cpp]calcScore(ootpoot, names[i], s1, s2, s3, s4, s5);[/cpp]
names[i]
[editline]7th October 2012[/editline]
Wait, I think it could be
[cpp]
void calcScore(ofstream &output, string[] name, float s1, float s2, float s3, float s4, float s5)[/cpp]
and when you declare and define 'names', it should be
[cpp]string[100] names;[/cpp]
Try that. I'm just guessing though.[/QUOTE]
An impressive amount of declaration problems if I try any of those solutions.
[editline]asdasd[/editline]
Actually...
[cpp]void calcScore(ofstream &output, string name, float s1, float s2, float s3, float s4, float s5)[/cpp]
seems to work in a sense. It outputs the names properly, but not writing it to the output file (only does the first one).
calcScore executes twice as in the for loop in main(), but doesn't write to results.dat twice.
Sorry that I couldn't help, I'm not that experienced in extensive use of strings in c++. Good luck though.
[QUOTE=Meatpuppet;37940606]Sorry that I couldn't help, I'm not that experienced in extensive use of strings in c++. Good luck though.[/QUOTE]
Guess something you suggested did fix that, but now the problem is that calcScore is not writing to the output file twice. It definitely outputs to console twice with the tally, but not the file.
[IMG]http://i.imgur.com/XV5Rl.jpg[/IMG]
As seen in the image above, I have a 2D array of tiles, each with 4 points in my game world. I'm looking for a method to convert these shapes constructed from individual tiles into simplified (no unnecessary vertices, only those needed to form the outline) polygon shapes.
I have been looking around, and have had very little luck. But maybe I don't know the correct terminology to search for. Any help is appreciated.
I'm looking to use this to optimize dynamic lighting. If someone has a different approach for accomplishing fast dynamic shadows in a tile based world, that will also answer the question.
Eliminate every vertex which lies between at least two other vertices and is not a corner vertex
The rest are implementation details
For example, if it's guaranteed that you will only ever optimize "full" grids, you could check the 3x3 neighborhood against a list of patterns and eliminate vertices whose neighborhood matches a pattern:
[code]x means vertex, - means no vertex
xxx
xxx
xxx
---
xxx
---
xxx
xxx
---
---
xxx
xxx
-x-
-x-
-x-
xx-
xx-
xx-
-xx
-xx
-xx[/code]
This can be easily parallelized, as each vertex can be individually processed.
-snip- stupid mistake
Sorry, you need to Log In to post a reply to this thread.