Labdabeta 182 Posting Pro in Training Featured Poster

In response to that, I was looking at sager notebooks, I definately do want to be able to game as well as do some hardcore number crunching. As such I was told by some friends of mine that a desktop w/ remote desktop would get me the but then again I am seeing a lot of the specs that you are talking about on the sager notebooks website, and sagers can come with up to 3 years of warranty. Whereas a custom desktop would obviously not have any warranty at all and I would have to do my own servicing on it. Do you think that a nice sager might be worth it? Also for the last four years I have been carrying a Dell Latitude D630 around school (since it is a private school, and that was the laptop they gave me). It is heavy, but I have definately gotten used to it!

Labdabeta 182 Posting Pro in Training Featured Poster

I finished trying to add the font a thousand ways to %systemroot%\Fonts and still Code::Blocks will not recognise it. Maybe it has a custom font folder?

Labdabeta 182 Posting Pro in Training Featured Poster

I want to use opengl to draw some stuff, not to the screen but to a data buffer instead. Is this possible? IE:

uint32_t *data;
glSetDrawTarget(data,GL_RGBA|GL_UNSIGNED_INT_8_8_8_8);//this is the line I cannot figuro out how to do
glBegin(GL_TRIANGLES);
//...
glEnd();
//and now my buffer is full of custom data
glSetDrawTarget(NULL,NULL);//reset to screen?
Labdabeta 182 Posting Pro in Training Featured Poster

I am not entirely sure about what you are attempting to accomplish, but there shouldn't be much of a problem. For one thing, you can make vectors of vectors to store many vectors like so:

vector<vector<type> >//note the space it is essential!

Also be careful to close all of your files when you are done with them. Regardless, since file IO can be very time costly, your program may be very slow.

Labdabeta 182 Posting Pro in Training Featured Poster

The thing is that I have an A+ certification manual and have been studying it, so I think I should be able to fix the computer fairly well on my own. Of course if I can't I can always post here :P I was originally thinking of a sager notebook, but I was told that I would get far more bang for my buck with a remote desktop which appeared to be true. Also, just how much bandwidth do you think I need for a good experience? Thank you for your reply!

Labdabeta 182 Posting Pro in Training Featured Poster

I have recently been accepted to software engineering at the university of waterloo, and as such my parents have agreed to go 50/50 on a nice computer to bring to waterloo. At first I was looking at a laptop, but then some IT friends of mine suggested that I could get a better desktop and then connect to it through remote desktop. As such I put together a list of parts that I think should work well, but as this is my first time putting a computer together from scratch I have been trying to get as many opinions as possible. Thus this post. Here are the specs for the computer that I put together:

Anyways I want to be absolutely certain that this will work, so any feedback would be helpful. Thanks.

Labdabeta 182 Posting Pro in Training Featured Poster

I have created a custom font for programming and I wish to use it in code::blocks. The thing is that code::blocks only allows for standard fonts (as far as I can tell) and so I cannot get it to recognise my font (even though it is a ttf). Here is the font, does anybody know how to load it into code::blocks?

Labdabeta 182 Posting Pro in Training Featured Poster

First of all realize how many elements you are storing, which is 115x4x114x114=5 978 160. Each element is a double, which is usually 64 bits (if I remember correctly) so 5 978 160x64=382 602 240 which is 382 megabits. Though this is well within the bounds of modern RAM, do be aware that you are storing quite a lot of data. Next you can use one of three techniques:

Technique 1: Real dynamically allocated multi-dimensional arrays:

This is a tricky one, but basically what you do is you realize that each array is a pointer, your array has 4 dimensions (it is an array of arrays of arrays of arrays of doubles) as such your new array is going to need 4 asterisks! Then you loop through each one useng the new operator to allocate your memory, like so:

double ****array;
//the following loops may be in reverse order, I cannot remember if you do 115-4-114-114 or 114-114-4-115
array=new double***[115];
for (int i=0; i<115; ++i)
{
    array[i]=new double**[4];
    for (int ii=0; ii<4; ++ii)
    {
        array[i][ii]=new double*[114];
        for (int iii=0; iii<114; ++iii)
            array[i][ii][iii]=new double[114];
    }
}

and now you can use array just as if it were as posted above.

Technique 2: Real multi-dimensional vector:

This is a bit less tricky, but do note that > > has a space between the symbols! Basically you make a vector of vectors of vectors of vectors of doubles.

vector<vector<vector<vector<double> > > > array;

Technique 3: Fake multi-dimensional vector + …

Labdabeta 182 Posting Pro in Training Featured Poster

I used learncpp.com they have excellent tutorials to teach you everything you need to know about c++ syntax. I am also working on a tutorial website myself (I have created almost 70 lessons so far) but that is more of a personal project. Also if you are so unimpressed with turboc++ you can try Code::Blocks, it is free and (in my opinion) nicer.

Labdabeta 182 Posting Pro in Training Featured Poster

I am wondering about what keyboard layouts the people that use this forum are using. I would suspect a higher quantity of Dvorak users (like myself) then most places. In my opinion there is no reason not to switch from QWERTY to Dvorak other than to switch from QWERTY to some programming oriented layout. Anyways, my friends think that I am one of a few people in the world that use dvorak. At least one dvorak user please reply that you use dvorak... although if enough people reply with what they use (QWERTY/Dvorak/Other) I could write a statistical report for my friends. Thank you.

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you! Those were perfect. By the way, the tutorial I used to use had a green-yellow background. If it ever resurfaces ill post it here, it was incredibly easy to follow and simple.

Labdabeta 182 Posting Pro in Training Featured Poster

I tried googling my butt off, but did not find any tutorial that had similar information that wasnt hiding behind a bunch of useless information which would take me quite a long time to sift through. If somebody knows the right functions off-hand that would be very helpful. I seem to recall SetConsoleXXX functions?

Labdabeta 182 Posting Pro in Training Featured Poster

I used to use a tutorial for windows console API, but the website was taken down :(. So now I need to ask how to do these things (which ALL were included on the website) in the console with windows API:

  • Mouse events (clicks and unclicks)
  • Cursor seeking (to any x/y coordinate)
  • Colour changing
  • Keyboard events (specifically arrow keys)
Labdabeta 182 Posting Pro in Training Featured Poster

I have made a few compilers for esoteric programming languages (I have no idea why but I find them fun to write :P) and I find that even making a simple compiler can be very tricky, c++ would be near impossible to write. Luckily, you can use g++ from a console command, and as such you can compile your code without writing the compiler yourself. Syntax highlighting is not as tricky, but is still a challenge. I have written one highlighter that turns a c++ source file into an HTML output file that is properly highlighted. I took a string as input, and made an array of the same length of an enum of code states, then wrote a function that runs throught the string and sets the array to have the right highlighting. Here is an example:

#include <iostream>
using namespace std;
int main()
{
    cout<<"Hello World!"<<endl;
    return 0;
}

becomes:

ppppppppppppppppppp
kkkkkkkkkkkkkkkkkkko
kkkcccccoo
o
    ccccoossssssssssssssoocccco
    kkkkkkcno
o

where p=PREPROCESSOR, k=KEYWORD, o=OPERATOR, c=REGULAR CODE, s=STRING LITERAL, n=NUMERIC LITERAL. If you need more help I could give you some source code, but I think you should try to figure it out yourself.

Labdabeta 182 Posting Pro in Training Featured Poster

We need to know what types wallet, account, and savings are. Also you never check if the file is open, so perhaps it isn't opening properly? Also it would be better to make just one file and re-use it then to make 3 files like this:

ofstream file;
file.open("file1");
file<<data;
file.close();
file.open("file2");
file<<data;
file.close();
//...
Labdabeta 182 Posting Pro in Training Featured Poster

Its complicated, but basically you need to add a level of pointer-ness. You can only return a value by address if you assign something to a memory location (IE: *var=value;) To do that here you can do this:

void enlargeArray(int **oldArr, int arraySize) 
{
   //oldArr is a dynamically allocated array

   int *newArr = new int[arraySize*2]; 

   //copy the elements from oldArr into newArr

   delete (*oldArr)[]; 

   (*oldArr) = newArr; 
}
Labdabeta 182 Posting Pro in Training Featured Poster

I think you should use a combination of inheritance and templates. Look them up.

Labdabeta 182 Posting Pro in Training Featured Poster

My guess is that it is reading a/b as one thing. Have you tried entering a / b instead? Also note that you do integer division, so if a is less than b you will get zero as your value.

Labdabeta 182 Posting Pro in Training Featured Poster

Here is one straight from wikipedia:

There are 10 types of people, those who understand binary and those who don't.

Labdabeta 182 Posting Pro in Training Featured Poster

I definately think that you should try debugging this. Windows gives the error your seeing usually when it has a sigseg fault. This means that at some point you get a NULL pointer and try using it as if it were not NULL (either dereferencing it manually, or passing it to a function that dereferences it). I would suggest adding checks the way that lazyfoo tutorials teaches (lazyfoo has great SDL tutorials) Here is what you should do for example at line 41-42 in main.cpp:

screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT,0,0);
if (screen==NULL)//uh-oh, error!
    return -1;//now if you see 'process finished with return value -1' you know that your screen didn't load!
claywin commented: So I should just do this with every line of code? One at a time? +0
Labdabeta 182 Posting Pro in Training Featured Poster

Thanks, I will try to see if I can get it to work... my goal is to eventually be able to create these functions:

void sendData(void *data, size_t datalen, char *IP, int port);
void readData(void *data, size_t *datalen, char *IP, int port);

That should not be too hard once I get the hang of sockets, should it?

Labdabeta 182 Posting Pro in Training Featured Poster

Here is a program I wrote for in october. It can even be used as a quine (command-line freadbits.exe freadbits.exe).

#include <stdio.h>
int main(int argc, char *argv[])
{
    if (argc!=2)
    {
        printf("freadbits [filename].[file-extension]\n\tShows the content of the given file.");
        return 1;
    }
    FILE *file=fopen(argv[1],"rb");
    if (!file)
    {
        char *fname;
        sprintf(fname,".\\%s",argv[1]);
        file=fopen(fname,"rb");
        if (!file)
        {
            printf("freadbits [filename].[file-extension]\n\tShows the content of the given file.");
            return 1;
        }
    }
    char tmp;
    while (!feof(file))//loop through the whole file
    {
        tmp=getc(file);
        char out[9];
        for (int i=0; i<8; i++)//create the output string
            ((tmp&(1<<i))>0)?out[i]='1':out[i]='0';
        out[9]=0;//null terminate the string
        printf(out);
    }
    return 0;
}

This should be the answer to your question (granted it is more C than C++).

Labdabeta 182 Posting Pro in Training Featured Poster

How do you test a simple socket program though? I only have 1 laptop...

Labdabeta 182 Posting Pro in Training Featured Poster

If you are trying to break a byte into bits you can do this:

struct byte{
    bool bit[8];
};
byte breakByte(uint8_t val)//break val into individual bits
{
    byte ret;
    for (int i=0; i<8; ++i)
        ret.bit[i]=((val>>i)&1);
    return ret;
}
byte fastBreakByte(uint8_t val)//this uses loop unwinding
{
    //by negating the loop, this may be faster depending on how well your compiler optimizes
    byte ret;
    ret.bit[0]=val&1;
    ret.bit[1]=(val>>1)&2;
    //...
    return ret;
}
bool getBit(uint8_t val, int ind)//get a specific bit
{
    return (val>>ind)&1;
}

Is this what you are asking for?

Labdabeta 182 Posting Pro in Training Featured Poster

So then, how do games like Call of Duty do it? Clearly they are able to set up a server (host) and clients.

Labdabeta 182 Posting Pro in Training Featured Poster

I have only just glanced at the multicast stuff, but does that mean that the only thing that I can specify about my socket is it's port? Arent there only 65535 ports available? Doesn't that mean that it will be very difficult to get a unique port for only your program? How can I make my programs connect to just the right host?

Labdabeta 182 Posting Pro in Training Featured Poster

Perhaps a path finding AI algorithm such as a depth first search (look it up) would be helpful. Basically if you can define this class you can solve any problem:

class Node
{
    private:
    //anything you need
    public:
    vector<Node> getAllPossibleMoves();//in this case it would return all valid selections of 0s in your matrix
    bool isVictory();//return true if this Node represents the goal
};

Hope this helps.

Labdabeta 182 Posting Pro in Training Featured Poster

I have now read a total of 5 different winsock tutorials and I still do not get how sockets work! Could somebody please explain how to make a program that will allow n computers to share data with each other. As an example could somebody make a 'game' with the following rules:

  1. check for the existence of the server (Give it a unique name?)
  2. if it does not exist, create it, you are now the SERVER
  3. if it does exist, join it, you are now a CLIENT
  4. As a server, repeatedly send out "GAME" to each client
  5. As a client in responce send back a string
  6. As a server print all of the recieved strings that are in response to a "GAME" call (add some code to the start of the string?)
  7. As a server, if the string "EXIT" is recieved in response to a "GAME" call, shut down the socket after sending a string.
  8. On socket shutdown, print the exit string recieved by the server if you are a CLIENT.

I really need help, sockets are making no sense whatsoever to me. Thank you.

Labdabeta 182 Posting Pro in Training Featured Poster

Obviously you do not understand. Let me see if I can explain. Take for example this class:

class myClass//it stores an int
{
    public:
    int myInt;
    myClass():myInt(0){}//default value is 0
    myClass(int i):myInt(i){}//you can set it on creation
    myClass(const myClass &o){myInt=o.myInt;}//copy constructor
};

This works fine, and it is the struct you are talking about. It is easy, I do not disagree! But lets say you have something like this:

class myVolatileClass//it stores an array of ints
{
    public:
    int *myInts;//stores an array of ints
    int numInts;//stores the number of ints in the array
    myClass():myInts(NULL),numInts(0){}//by default myInts is null and stores nothing
    myClass(int *ints, int num)//copies the array of ints
    {
        myInts=new int[num];
        for (int i=0; i<num; ++i)
            myInts[i]=ints[i];
        numInts=num;
    }
    myClass(const myClass &other)//a copy constructor
    {
        myInts=new int[other.numInts];
        for (int i=0; i<other.numInts; ++i)
            myInts[i]=other.myInts[i];
        numInts=other.numInts;
    }
    ~myClass()//this class requires a custom destructor to clean up the array
    {
        if (numInts>0)//if there are ints in the array
            delete[]myInts;//delete the array
    }
    int get(int index)//function to access a member of the array
    {
        if (index>=0&&index<numInts)//check that it is a valid index
            return myInts[index];
    }
    void add(int val)//add a value to the array
    {
        int *tmp=new int[numInts+1];//temporary storage for the new array
        for (int i=0; i<numInts; ++i)
            tmp[i]=myInts[i];
        tmp[numInts++]=val;
        if (numInts>0)
            delete[]myInts;
        myInts=tmp;
    }
};

Again this class is simple and works as you would expect... except look at this situation:

int main()
{
    int mydata[]={1,2,3};
    myVolatileClass c(mydata,3);
    //here we will cause an error:
    c.numInts=0;//trololol
    c.add(4);//sigseg here
    return 1;
}
Labdabeta 182 Posting Pro in Training Featured Poster

I thought I should clarify a bit. I want to understand how to do this (or how to change it to do a similar task):

class Server
{
    private:
    //what?
    public:
    Server(string name);//create server with name 'name'
    ~Server();//close the server
    void send(unsigned char *data, int datalen);//send data to all the people connected to this server
    bool recieve(unsigned char *data, int &datalen);//recieve whatever data has been sent to the server, return true if there has been data recieved
};
class Client
{
    private:
    //what?
    public:
    Client(string name);//connect to the server named 'name'
    ~Client();//close the client
    void send(unsigned char *data, int datalen);//send data to all the people on the same server
    bool recieve(unsigned char *data, int &datalen);//recieve whatever data has been sent over the server, return true if there has been data recieved
};

The goal is to be able to do something like this:

Computer 1 server.cpp:

Server myServer("Computer1servername");
myServer.send("ONLINE",6);
bool quit=false;
while (!quit)
{
    unsigned char *data;
    int datalen;
    while (myServer.recieve(data,datalen))
    {
        if (compare(data,datalen,"QUIT",4))//assume compare already exists
            quit=true;
    }
}
myServer.send("OFFLINE",7);

Computer 2 client.cpp:

Client myClient("Computer1servername");
unsigned char *data;
int datalen;
while (!myClient.recieve(data,datalen));
if (compare(data,datalen,"ONLINE",6))//assume compare already exists
{
    myClient.send("QUIT",4);
}

I do not want raw source code. I want an understanding of what would be required.

Labdabeta 182 Posting Pro in Training Featured Poster

I have looked at a few winsock tutorials, I just do not understand them at all. None of them really give great explanations of how sockets work. For example how can I send data to a bunch of different computers at once. And how can I check if they have read it. I have very little understanding of how wireless stuff works, any explanation would be greatly appreciated.

Labdabeta 182 Posting Pro in Training Featured Poster

I am trying to understand how sockets work with winsock, but I just don't get it. I basically want to be able to create these functions:

SomeDataType ConnectToComputer(const char *ConnectionName);//connect to the connection named ConnectionName
SomeDataType CreateConnection(const char *ConnectionName);//create a connection called ConnectionName
bool ReadData(SomeDataType, unsigned char *outdata, int outsize);//read outsize bytes into outdata from the connection and return on success
void SendData(SomeDataType, unsigned char *data, int datalen);//send the data to the connection

Basically this is what I want to be able to do with those functions:

//This is called by the first computer to 'join' the room
SomeDataType myConnection=CreateConnection("My Room Name");
SendData(myConnection,"Connection up!",14);
vector<string> names;
unsigned char *buffer=new unsigned char[255];
while (ReadData(myConnection,buffer,255))
{
    names.push_back(string(buffer));
}
cout<<"The names of those in this connection are:"<<endl;
for (int i=0; i<names.size(); ++i)
    cout<<"\t"<<names[i]<<endl;


//This is called by the other computers to 'join' the room
SomeDataType myConnection=ConnectToComputer("My Room Name");
unsigned char *buffer=new unsigned char[255];
while (!ReadData(myConnection,buffer,14));
if (!stringsAreEqual(buffer,"Connection up!"))
    return -1;//this is the wrong room! It is not following the rules!
SendData(myConnection,"myName",6);//now the host will say my name to the screen

How do you do this? (I am willing to modify the functions)

Labdabeta 182 Posting Pro in Training Featured Poster

It would be possible, but why use an array of arrays when you can use vector<string> and have the same effect. Basically vector<string> s is the same as char s[infinity][infinity] so why not use it? Also you may want to add a isGreater(string s1, string s2) function to help you in your sorting function.

Labdabeta 182 Posting Pro in Training Featured Poster

Modularation would help make your code more legible. Use a function for each task you want to accomplish. In this case I would do something like this:

#include <iostream>
#include <string>//because they are easier than using c-style arrays of characters
#include <fstream>//for file IO
#include <vector>//Again they are easier than using a normal array, and they are dynamic
using namespace std;
string readFile(string fname);//read the entire contents of a file
struct CityName//a structure to hold city, name, and surname
{
    string city;
    string name;
    string surname;
};
vector<CityName> parseString(string fcontents);//parse the fcontents string into an array of CityName structures
void sortCityName(vector<CityName> &vec);//sort the vector
void printCityName(CityName cn);//print the cityname
int main()
{
    string contents=readFile("myFileName.txt");//get the file contents
    vector<CityName> array=parseString(contents);//parse the file contents
    sortCityName(array);//sort the array
    for (int i=0; i<array.size(); ++i)//loop through the whole array
        printCityName(array[i]);
    return 0;
}
Labdabeta 182 Posting Pro in Training Featured Poster

also how do you do the code part, instead of pasting here?

This is an easy one just hit ENTER twice so that you have 2 blank lines. Now paste your code on the bottom one, then select all the code and hit TAB once.

As for file writing, once you have your answer you can use the fstream library like so:

#include <fstream>
using namespace std;
int main()
{
    cout<<"Testing file IO..."<<endl;
    fstream file("myFile.txt");//opens myFile.txt
    file<<"This is a test... 3*3="<<3*3<<endl;//file output
    file.close();
    return 0;
}
Labdabeta 182 Posting Pro in Training Featured Poster

You could use an fstream object. Here is a nice wrapper class to act exactly like cout except it goes to screen and file:

class fcoutstream
{
    private:
    fstream file;
    public:
    fcoutstream(const char *fname){file.open(fname);}
    ~fcoutstream(){file.close();}
    template <typename T> fcoutstream &operator<<(const T& t)
    {
        cout<<t;
        file<<t;
        return *this;
    }
    template <typename T> fcoutstream &operator>>(T& t)
    {
        //you need to decide which one you want:
        //read from file:
        //file>>t;
        //read from cin:
        cin>>t;
        return *this;
    }
};
Labdabeta 182 Posting Pro in Training Featured Poster

I have the following code to draw a scene to opengl, but nothing shows up, just a blank screen!

void glCameraDraw(const LABglCameraHANDLE h, LABglWindowHANDLE LABglGlobals)
{
    if (!h->isProjected)//check to see if h's projection is loaded
    {
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        //LABglGlobals->LABglDimensions are the screen dimensions
        gluPerspective(h->fov,(float)LABglGlobals->LABglDimensions.right/
                              (float)LABglGlobals->LABglDimensions.bottom,
                       h->front,h->back);
        h->isProjected=true;
    }
    //set the viewport
    glViewport(0,0,LABglGlobals->LABglDimensions.right,LABglGlobals->LABglDimensions.bottom);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    //move and rotate as per the rules in my camera
    glTranslatef(-h->loc.x,-h->loc.y,-h->loc.z);
    glRotatef(h->rot.pitch,1,0,0);
    glRotatef(h->rot.yaw,  0,1,0);
    glRotatef(h->rot.roll, 0,0,1);
    //loop through the models in the window (they are stored as array of pointer to pointer 
    for (int i=0; i<LABglGlobals->LABglNumModels; ++i)
    {
        if (*(LABglGlobals->LABglModels[i]))//check that this particular model exists
        {
            glLoadIdentity();
            //bind this model's texture
            glBindTexture(GL_TEXTURE_2D,(*(LABglGlobals->LABglModels[i]))->texture->glTexture);
            //set the color
            glColor4b(((*(LABglGlobals->LABglModels[i]))->blend&0xFF000000)>>24,
                      ((*(LABglGlobals->LABglModels[i]))->blend&0x00FF0000)>>16,
                      ((*(LABglGlobals->LABglModels[i]))->blend&0x0000FF00)>>8,
                      ((*(LABglGlobals->LABglModels[i]))->blend&0x000000FF));
            glCallList((*(LABglGlobals->LABglModels[i]))->displayList);//call the precomiled display list
        }
    }
    SwapBuffers(LABglGlobals->LABglhDC);
}          

I cannot see what is wrong with that code? Any ideas.

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you.

Labdabeta 182 Posting Pro in Training Featured Poster

I tried integrating over the pdf, but the values were all so small that they were being stored as 0.0, so I used wikipedia to find the integral above. I have been playing around on my TI calculator and have found an approximate expression for chicdf(X):

double chicdf(double x)
{
    return (-1/(1+pow(M_E,(-(x-256)/14))))+1;
}

Its maximum error at x=255 is about -0.3 which is about a 6% error. Any ideas on a better solution?

Labdabeta 182 Posting Pro in Training Featured Poster

I need to calculate chi squared cdf from x->infinity with n=255 degrees of freedom. I cannot seem to get it to work. You can find formulae for chi squared distributions using google. Here is my non-functional approximation code:

double riemannsum(double(*fnc)(double),double dx, double xmin, double xmax)
{
    double ret=0;
    double x=xmin;
    while (x<xmax)
    {
        ret+=fnc(x);
        x+=dx;
    }
    return ret;
}
double lowergammaintegrand(double x)
{
    return pow(x,254)*pow(M_E,-x);//I am only using 255 degrees of freedom in this program
}
double lowergamma(double x)
{
    return riemannsum(&lowergammaintegrand,10,x,10000000);
}
double chicdf(double x)
{
    static double gamma1275=3.40511e214;//this is Gamma(127.5)=Gamma(k/2)
    return lowergamma(x)/gamma1275;
}
Labdabeta 182 Posting Pro in Training Featured Poster

The main difference between a depth first search and a breadth first search is what data type you use to store your nodes. In a breadth first search you use a queue, in a depth first search you use a stack. Basically a queue is like a line-up, you put things in the back and take things out the front. A stack is like a deck of cards, you put things on the top and take things off the top. Both algorithms are identical in all other aspects so you can google either of them to get the required pseudocode.

Labdabeta 182 Posting Pro in Training Featured Poster

That code would not compile for me as GL_ARGB_EXT was undefined. If I don't have to use POT textures then I don't need dx or dy do I?

Labdabeta 182 Posting Pro in Training Featured Poster

I feel like I need a HUGE hardware update since NPOT textures do not work on my comp, and neither do vertex buffer objects, pixel buffer objects or really any kind of buffer object! Luckily I graduate high school in a few months and will be getting a brand new desktop. For now how can I test my opengl applications (without exporting them to a newer computer)? My current computer is pushing 6 years old.

Labdabeta 182 Posting Pro in Training Featured Poster

Here is my updated code... should it work?

union colour
{
    uint32_t rgba;
    struct{
        uint8_t r;
        uint8_t g;
        uint8_t b;
        uint8_t a;
    }bigendian;
    struct{
        uint8_t a;
        uint8_t b;
        uint8_t g;
        uint8_t r;
    }littleendian;
};
struct sprite
{
    int w,h;
    uint32_t texture;
    colour *data;
};

glTexImage2D(GL_TEXTURE_2D, 0, 4, sprite.w, sprite.h, 0, (isBigEndian()?GL_RGBA:GL_ABGR),GL_UNSIGNED_BYTE,sprite.data);

I just want to make sure I understand. Is it no longer true that all textures must be of size 2^n x 2^n?

Labdabeta 182 Posting Pro in Training Featured Poster

I did check that tutorial, but they were vague as to how the data was stored (they let the OS store the data for them) and I need access to the raw data. As you can see my data is stored as ARGB or BGRA depending on endianness. I have a function called isBigEndian() that checks it. Basically this is what I have so far:

glTexImage2D(GL_TEXTURE_2D, 0, 4, sprite.w*sprite.dx, sprite.h*sprite.dy, 0, (isBigEndian()?/*I need ARGB mode here*/:/*I think I need BGRA mode here*/), /*what type am I using?*/, sprite.data);
Labdabeta 182 Posting Pro in Training Featured Poster

Show us main.cpp, it may help. Also use code indentation correctly (note: before leaving the 4 spaces you have to leave a new line)

Labdabeta 182 Posting Pro in Training Featured Poster

I have an array of data of the form:

union colour
{
    unsigned int argb;
    struct{
        unsigned char a;
        unsigned char r;
        unsigned char g;
        unsigned char b;
    }bigendian;
    struct{
        unsigned char b;
        unsigned char g;
        unsigned char r;
        unsigned char a;
    }littleendian;
};
struct sprite
{
    int w,h;//stores the dimensions
    double dx,dy;//stores what to divide 1.0 by to get to the edge of the usable image
    colour *data;//stores the image
    unsigned int glTexture;//stores the opengl texture
};

And I need to find a way to populate it based solely on w,h and data. dx and dy may need a little more explanation, basically they allow for non 2^n size images by saying "divide your 1.0f by d(x/y) to get the edge of the real image, rather than the edge of the filler space. I think I need to use glTexImage2D but the API is somewhat vague as to how exactly to implement it. Any help would be greatly appreciated. Thanks.

Labdabeta 182 Posting Pro in Training Featured Poster

Aha! For some weird reason the default setting was for debug builds to NOT create .a files, so I was using files from my last Release build, which was incomplete.

Labdabeta 182 Posting Pro in Training Featured Poster

Yes, although my compiler called it MyDLLName.DLL.a I only get the link errors on some seemingly arbitrary functions. The link error I get looks like:
undefined reference to '_imp__LABglClose@4'

Labdabeta 182 Posting Pro in Training Featured Poster

Usually, you can put it any of the folders listed in your PATH environment variable, such as c:\windows\system. Af for the *.h file(s), just put the full path to where they are located in the include statement, e.g. #include "c:\mydir\test.h" Application programs do not need any of the other files you mentioned.

The problem is that I tried that and I got a ton of link errors! I know that that method worked for two other DLLs I made (one for random numbers, one for infinite math) I feel like I did something wrong in this DLL project's settings.