380 Posted Topics

Member Avatar for gethelpcpp123

The problem is at line 14. Using that loop is an issue. It should just be: sencence[i]=sentence1[i]; Here is why. Take the sentence "The cow moved." Lets debug the code. At i=0: T isalnum=true, sentence1 is copied from 0 to i(0) into sentence, sentence="T" At i=1: h isalnum=true, sentence1 is …

Member Avatar for Labdabeta
0
223
Member Avatar for nekoleon64

I am having trouble reading your code, but I understand the difficulty in the new system. To start a code block simply skip a line and indent by for. As such this does not work, even though as I type it it is highlighted like code, it will not show …

Member Avatar for HWalkmanWTN
0
175
Member Avatar for Labdabeta

I never knew that near and far were reserved until I made a struct for bounding boxes like this: struct boundingBox { float near, far; float left,right; float top,bottom; }; Does anybody know what near and far do, because I got the error that the declaration does not declare anything. …

Member Avatar for Labdabeta
0
123
Member Avatar for jerryjerry

The problem is (as far as I can tell) that you are getting caught by garbage cleanup of some kind. You created an A but it doesnt have a memory space (since new didnt return one) as such when the program ends the operating system tries to automatically destroy a, …

Member Avatar for L7Sqr
0
241
Member Avatar for RainbowMuffin
Member Avatar for thines01
0
142
Member Avatar for Labdabeta

I want to test some graphics work I am doing with the Utah Teapot model. The issue is that all the data I can find on it uses bezier patches (which I have no clue how to render) does anybody know how I could get the data in a form …

Member Avatar for Labdabeta
0
525
Member Avatar for Labdabeta

I want to find a range of values that a valid pointer cannot achieve, but can store. Basically this is my situation: typedef struct myNumberTAG { //stuff }*myNumberHANDLE; //A bunch of functions that work with myNumberHANDLEs: ///Not Shown //Some constants const myNumberHANDLE numberOne=0x1; const myNumberHANDLE numberTwo=0x2; const myNumberHANDLE numberInfinity=0x3; const …

0
56
Member Avatar for Labdabeta

I am sorry to have to make a new thread for this, but as I cannot reply to any threads I cannot think of another easy option. Basically when I enter my message and click the submit button, a red box shows up and says "Message field required" How can …

Member Avatar for Dani
0
311
Member Avatar for Labdabeta

I currently have the following code for a sprite struct (c-style for use in DLL): typedef struct LABglSpriteTAG { unsigned int glTexture; int w; int h; LABglColour *data; bool compiled; }*LABglSpriteHANDLE; And the following function: void LABglSpriteConvolute(LABglSpriteHANDLE spr, int w, int h, int *kernel) { size_t dim=spr->w*spr->h; LABglColour *out=new LABglColour[dim]; …

Member Avatar for mike_2000_17
0
1K
Member Avatar for geekdevil

I think that what sergent may be getting at is the idea of a more event-driven programming structure for games. I myself also made a working console snake game (I used colour, variable snake length, and extended ASCII to make it look good :P) and found that having code in …

Member Avatar for Labdabeta
0
320
Member Avatar for phorce

Can you maybe post what your iniMatrix class looks like? Also just to maybe catch any premature problems here is some sample vector of vector code: vector<vector<type> /*note the space that must be here*/> vec; vector<type> newVec;//this can be set to actually hold something; vec.push_back(newVec); vector<type> backVec=vec.back();//this will return the …

Member Avatar for Labdabeta
0
141
Member Avatar for Labdabeta

I am wondering how to perform a 2D image blit with openGL. I used to use SDL and it was easy, but with opengl I end up making a rectangle with texture coords that is sunk a little into the screen. Is there any way to perform a 'real' blit? …

Member Avatar for Labdabeta
0
527
Member Avatar for paintballer1518

I would suggest debugging your code. You can then see where you go wrong. There are many mistakes regarding arrays, I would suggest you read some material on how they work. Also, your swap function does no sorting at all. In fact I don't think it even swaps the data, …

Member Avatar for paintballer1518
0
2K
Member Avatar for nuclear

I am not an expert, as I only recently started learning opengl myself, but from my understanding glLoadIdentity() clears the currently selected matrix. If you read through the [URL="http://www.opengl.org/sdk/docs/man/xhtml/"]OpenGL Documentation[/URL] thoroughly, you will find that OpenGL stores four matrices of data. I learnt about them from a very helpful tutorial …

Member Avatar for Labdabeta
0
225
Member Avatar for Labdabeta

I am working on a game making (or really just general program making, but my question applies to games) DLL for opengl. It is almost done but the collision detection is a little bit slow since it has to calculate bounding boxes for each object repeatedly. I was thinking of …

Member Avatar for Labdabeta
0
170
Member Avatar for Chuckleluck

I do not know of any resources off hand, but I used to use GML's automatic collision detection and it gave a half-decent explanations in the help files. It said that it starts by checking a bounding box defined by the most extreme points on the image. A bounding box …

Member Avatar for raptr_dflo
0
303
Member Avatar for FraidaL

The derivative will not be a single integer, I think you want the value of the derivative at a specific point, in that case you will need to be given the point (x). Also, how are you supposed to know how long the array is if you don't pass a …

Member Avatar for Lerner
0
3K
Member Avatar for jone1734

Also shouldn't you use some kind of heuristic algorithm for making the computer play. You can do it with simple if statements and loops, or if you up for a challenge a minimax algorithm with alpha beta pruning allows for a variable AI.

Member Avatar for Labdabeta
0
208
Member Avatar for Labdabeta

I recently looked at [URL="http://www.songho.ca/opengl/gl_vbo.html"]this[/URL] description of VBOs and a sample implementation of them. When I ran the executable, it was significantly faster with no VBOs than with them. I don't understand why it should be slower with the VBOs than without. Can anybody explain why?

Member Avatar for raptr_dflo
0
331
Member Avatar for AdamLad3

Modularization will be key here. If you have not yet learnt functions, look them up. Then you can make your main look like this: [CODE]const int numNames=10;//this helps make the code more flexible int main() { char name[numNames][80]; for (int i=0; i<numNames; ++i)//use a loop gets(name[i]); char firstNames[numNames][80]; char lastNames[numNames][80]; …

Member Avatar for Damian Dalton
0
1K
Member Avatar for animeocarl

I haven't read all your code... but why in your record structure do you declare a bunch of string arrays of size true (1)?

Member Avatar for Ancient Dragon
0
224
Member Avatar for availalble4you

To edit you merely overwrite data usually (output the old data, input the new) to delete you usually remove the element by shifting all those after it back by one. I would suggest that an std::vector would be extremely useful in this situation.

Member Avatar for Labdabeta
0
138
Member Avatar for dariaveltman

If sort works then you should have no trouble with sort2. In fact please delete sort2. The thing you do not seem to realize is that sort and sort2 are EXACTLY the same. Just changing the name of the parameters does not change the function. Here is an example: [CODE]void …

Member Avatar for Labdabeta
0
131
Member Avatar for Labdabeta

I am trying to find a bug in my new and (theoretically) improved syntax highlighter program. I have made 3 versions now and have been able to debug them all with ease. Unfortunately my debugger does not do well with std containers as it shows ALL the information they contain …

Member Avatar for Labdabeta
0
351
Member Avatar for PIXXAR

This can be easily done with a loop: [CODE]int main() { bool exit=false; while (!exit) { //CODE HERE! //somewhere have: /* if (user_want_to_quit) exit=true; */ } return 0; }[/CODE]

Member Avatar for PIXXAR
0
1K
Member Avatar for minxminx

That is a lot of code! I have not read over it, but I would suggest that this should work: [CODE]int main() { time_t start=time(NULL);//get start time //TONS OF TIME CONSUMING CODE!!! time_t end=time(NULL);//get end time time_t deltatime=start-end;//this now stores how long the code took! //output? return 0; }[/CODE]

Member Avatar for Labdabeta
0
624
Member Avatar for Labdabeta

How exactly do you use a glConvolutionFilter2d() call? I know about convolution filters and kernels, but am not sure exactly how to implement them. Just a simple example with say... a gaussian blur, would be helpful.

Member Avatar for Labdabeta
0
138
Member Avatar for Labdabeta

I understand that data on computers can be compressed (I see it all the time with zip files and jpegs) but I was wondering just how compression works. Thinking it through, if you data is represented by 1s and 0s then it can be corresponded 1 to 1 with a …

Member Avatar for Labdabeta
0
250
Member Avatar for NinjaLink
Member Avatar for NinjaLink
0
142
Member Avatar for ambinh

You have a fair bit of code there... could you use [ CODE ] tags to get it highlighted for us?

Member Avatar for ambinh
0
159
Member Avatar for lw2025

I am not certain, but I do not think that [ICODE]if (opr='+',...)[/ICODE] works. I would suggest trying: [CODE]if (opr='+'||opr='-'||...)[/CODE]

Member Avatar for lw2025
0
148
Member Avatar for SpiderMan120988

For sorting I would suggest looking up [URL="http://en.wikipedia.org/wiki/Sorting_Algorithms"]sorting algorithms[/URL]. Once an array is sorted you can use a [URL="http://en.wikipedia.org/wiki/Binary_search_algorithm"]binary search[/URL] to find an element.

Member Avatar for Ancient Dragon
0
962
Member Avatar for Labdabeta

How do you make shadows in OpenGL. I have been using the NeHe tutorials, but I do not understand their shadow lesson. Can anybody help?

Member Avatar for mike_2000_17
0
380
Member Avatar for hey.howdy

First of all, why make a modulus function. There is a pretty little operator for that in c++ (%). Also I would suggest avoiding infinite loops and relying on the system to stop your program. Instead use a boolean to wait for... what? I have no Idea what the goal …

Member Avatar for histrungalot
0
211
Member Avatar for tom12

You did not design your functions as well as you could have. That will make it hard. A function should be a single simple task, and it should do the entire task as expected. The function RemoveSpaces() then should probably take a string and... remove all its spaces. A sample …

Member Avatar for tom12
0
148
Member Avatar for triumphost

I think that the best way to do this is probably through another function definition. Basically you can use your function, but also declare one like this: [CODE]DOSTUFF& Insert() { //whatever you do with no parameters }[/CODE] I am not sure if it would work, but I would think that …

Member Avatar for mrnutty
0
4K
Member Avatar for Labdabeta

I have the following collision detection function that checks the collision between the line defined by lstart -> lend and the triangle defined by points a,b and c with a normal of nvec. I want to know if it will work and what to put into the missing part. (it …

0
75
Member Avatar for Labdabeta

A few friends and I made a bet to see who could single-handedly (we defined that as a team of up to 10 people, all of whom must be personal friends) make the best video game over the course of two years. I am planning on making a first-person horror …

Member Avatar for Labdabeta
0
229
Member Avatar for Vasthor

First of all, you could save yourself some time on lines 6-10 by just using [ICODE]using namespace std;[/ICODE] Also, I assume you are trying to find the interquartile range? In that case this can be done in very simple linear time. Think about this, there are three quartiles (the points …

Member Avatar for mike_2000_17
0
107
Member Avatar for butler273

Any array is just a pointer to its first value, followed by allocated memory for the remaining values. As such this will work: [CODE]int myArray[]={5,3,6,8,4,2,9,1,10,7}; int *pntrToMyArray=myArray; //at this point myArray and pntrToMyArray are exactly the same. //note also that you can pass myArray directly to a function that uses …

Member Avatar for Labdabeta
0
161
Member Avatar for minghags

I do not know much about std::sort, but it is easy enough to sort this array manually. I would suggest using an insertion sort for each student entered, since it works really fast if the array is mostly sorted. Here is a sample implementation: [CODE]//This function will sort the vector …

Member Avatar for jaskij
0
1K
Member Avatar for Zvjezdan23

I have not read all of your code, but from a quick scan I would suggest printing a space where the character used to be.

Member Avatar for Labdabeta
0
527
Member Avatar for Labdabeta

I have a program that dynamically allocates an array and uses it. The thing is that under certain situations this array will get infinitely long. As such I would like to know if/when the array has gotten too long and then start saving it to a file (where length will …

Member Avatar for Labdabeta
0
173
Member Avatar for kearwood

A) CODE tags make your code easier to read. B) What is setYear doing?! [CODE]void Movie::setYear(int num) { while(Year < 2013)//while year < 2013 ++Year;//++year //now year will be... 2013, regardless of num? }[/CODE] Perhaps this would work better? [CODE]Movie &Movie::setYear(int year)//I am going to return this, to allow for …

Member Avatar for Labdabeta
0
480
Member Avatar for Labdabeta

Hello, I have been working with opengl and other graphics libraries and they all require the bits per pixel of the screen on initialization of a window. My question is, is there any way to get the system's preffered bits per pixel? or that of the monitor?

Member Avatar for Labdabeta
0
910
Member Avatar for Labdabeta

A friend of mine recently asked me to help debug some code. I looked through it and it was riddled all over with goto statements. I know why he uses them (he used to program mainly in assembly and batch) and I tried to explain why he should try to …

Member Avatar for Labdabeta
0
421
Member Avatar for SoftShock

The problem is not the col variable. It is the scores1 and scores2 variables. Basically you tried to access the member of an array (arrays are just pointers) of a variable that was not even an array. The [] operators are almost exclusively for array and array-like objects.

Member Avatar for Labdabeta
0
195
Member Avatar for Labdabeta

I am getting ready to write a programming competition on Tuesday (the Canadian Computing Competition) and I remember that last year it said that only standard libraries can be used. I was having trouble deciding which libraries are standard. I ended up using windows.h and when I suddenly realized that …

Member Avatar for Labdabeta
0
191
Member Avatar for Labdabeta

To what extent does the system endianness effect a program. I know that doing pointer assignment will be affected, and unions are too, but what about bitshift operators? Do they apply to the value, merely emulating real bitshifts, or do they apply to the bits themselves? Are there any other …

Member Avatar for Labdabeta
0
89
Member Avatar for grh1107

Think about it logically. You have O(N) executions of loop N and N executions of loop M. I would think that the complexity then would be O((N^2)M) of course I do not really know much about big-O notation (I just self-taught myself it) does anybody know if O((N^2)M) is right, …

Member Avatar for mrnutty
0
315

The End.