Labdabeta 182 Posting Pro in Training Featured Poster

I am still having major trouble with my openGL model program. The big issue is that I cannot figure out how to debug it since I am saving the important data to the graphics chip using vertex buffer objects (VBOs) so at least as far as I can tell, I cant read it. Also I am no computer so I cant interpolate the data. Anyways here is my code:

#ifdef LAB3DGLGUI_H
#ifndef GLMODELS_H
#define GLMODELS_H
#ifndef GOODGL
typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
PFNGLGENBUFFERSARBPROC glGenBuffersD=(PFNGLGENBUFFERSARBPROC)wglGetProcAddress("glGenBuffersARB");
PFNGLBINDBUFFERARBPROC glBindBufferD=(PFNGLBINDBUFFERARBPROC)wglGetProcAddress("glBindBufferARB");
PFNGLBUFFERDATAARBPROC glBufferDataD=(PFNGLBUFFERDATAARBPROC)wglGetProcAddress("glBufferDataARB");
PFNGLDELETEBUFFERSARBPROC glDeleteBuffersD=(PFNGLDELETEBUFFERSARBPROC)wglGetProcAddress("glDeleteBuffersARB");
#else
    #include <gl/glext.h>
#endif
#include <stdio.h>

struct glVertexStructure
{
    float vert[3];
    float text[2];
    float norm[3];
}NULLV;

/*   Model File Format (.mdl)
    4 bytes (int)                    ->  numv
    32*numv bytes (glVertexStructure)->  vars
                                        ->  12 bytes (float[3])     ->  vert
                                        ->  8 bytes (float[2])      ->  text
                                        ->  12 bytes (float[3])     ->  norm
*/
int HIGH_ID=0;
int COMPILED_ID=0;
class glModel
{
    private:
    int id;
    unsigned int numv;
    unsigned int model;
    glVertexStructure *vars;
    glModel &Compile();
    public:
    glModel():numv(0),model(0),vars(0),id(++HIGH_ID){}
    glModel(const glModel&);
    glModel(const char*);//Load from .mdl
    ~glModel()
    {
        if (numv>1)
            delete[]vars;
        else if (numv>0)
            delete vars;

        //Clean up VBOs??? Research needed!
    }
    glModel &operator=(const glModel&);
    glModel &operator=(const char*);//Load from .mdl
    glModel operator+(const glVertexStructure&)const;//Add Vertices
    glModel operator+(const glModel&)const;
    glModel &operator+=(const glVertexStructure&);//Append Vertices
    glModel &operator+=(const glModel&);
    glModel &Load(const char*);//Load from .mdl
    glModel &Save(const …
Labdabeta 182 Posting Pro in Training Featured Poster

On line 24 your limiting break statement may be met soon enough so vec becomes longer than vec itself so the error is saying that the subscript ([] is actually called the subscript operator) is too high. Also you dont have to use the break statement, it would be cleaner (though still incorrect logically) to do this:

for(unsigned long int i = 0; num2!=num; i++)
{
num *= vec[i];
vec2.push_back(vec[i]);
}
Labdabeta 182 Posting Pro in Training Featured Poster

I have no intention of buying it until I have "done my homework" thus the reason I am posting here. I was just wondering about its exports (I have learnt most that can be known about its interfaces and abilities that I could find online) because I am working on a C++ header file for OpenGL Vertex Buffer Objects using only triangles and was wondering if the exported model files would be all triangles, or if it would be a mix (making VBO's harder to use) basically if somebody could help me find out more about the Maya model files (usage and content) that would be greatly appreciated. Thank you.

Labdabeta 182 Posting Pro in Training Featured Poster

What are model files, and how do I use them in the context of an opengl application?

Labdabeta 182 Posting Pro in Training Featured Poster

Really quick question (I hope) before I buy Maya I want to know if it has the option of exporting coordinates for triangle vertexes rather than images. If it doesn't, is there software that would allow for modeling while exporting vertexes for 3d triangles?

Labdabeta 182 Posting Pro in Training Featured Poster

I am still unable to get OpenGL Vertex Buffer Objects to work. I will just show you the code I have written so far:

3dglgui.h (I think this should be fine):

#ifndef CLASS_NAME
#define CLASS_NAME "OpenGL Windows Class"//This can be overwritten to specify a unique class name
#endif
//Header Guards and version number
#ifndef LAB3DGLGUI_H
#define LAB3DGLGUI_H 1.0

//Error codes
#define ERR_NO_ERROR                        0x0000
#define ERR_CLASS_REGISTRY_FAILED           0x0001
#define ERR_FULLSCREEN_FAILED               0x0002
#define ERR_WINDOW_CREATION_FAILED          0x0004
#define ERR_GET_DC_FAILED                   0x0008
#define ERR_PIXEL_FORMAT_CHOICE_FAILED      0x0010
#define ERR_NO_VALID_PIXEL_FORMAT           0x0020
#define ERR_GET_RC_FAILED                   0x0040
#define ERR_MAKE_CURRENT_FAILED             0x0080
#define ERR_OPENGL_INITIALIZATION_FAILED    0x0100
#define ERR_RELEASE_DC_RC_FAILED            0x0200
#define ERR_RELEASE_RC_FAILED               0x0400
#define ERR_RELEASE_DC_FAILED               0x0800
#define ERR_RELEASE_WINDOW_FAILED           0x1000
#define ERR_RELEASE_WINDOW_CLASS_FAILED     0x2000

#define APART(X) ((float)((char)((X)>>24))/255.0)
#define RPART(X) ((float)((char)((X)>>16))/255.0)
#define GPART(X) ((float)((char)((X)>>8))/255.0)
#define BPART(X) ((float)((char)((X)))/255.0)

#define DEGTORAD(X) ((X)*0.0174532925)
//Includes
#include <math.h>//for trig ratios and sqrt
#include <windows.h>//for windows
#include <gl/gl.h>
#include <gl/glu.h>
#define GL_GLEXT_PROTOTYPES
#include <gl/glext2.h>
#include "models.h"
//typedefs
typedef GLuint glTexture;//Storage for one (or more) textures
typedef unsigned int glColour;//Stores a colour as 0xAARRGGBB
//Unique main function
#define main() WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevhInstance, LPSTR cmdline, int cmdshow)
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
class glFont
{
    private:
    unsigned int letters;
    GLYPHMETRICSFLOAT chars[256];
    public:
    void Load(const char *fname, int height, int weight, bool italic, bool underline, bool strikethrough, float depth);
    void operator()(const char *str);
    ~glFont(){glDeleteLists(letters,255);}
};
class OpenGLInstance
{
    private:
    GLUquadricObj *quadricobject;
    HDC hDC;
    HGLRC hRC;
    HWND hWnd;
    HINSTANCE hInstance;
    LONGLONG tm;
    public:
    short ERRORCODE;
    struct windowdatastructure
    {
        bool key[256]; bool active; bool fullscreen; int w; int h; int fps;
    }window;
    struct mousedatastructure
    {
        int x; int y; …
Labdabeta 182 Posting Pro in Training Featured Poster

I feared as much :( time to write a function filled with string comparisons to each function I write... thanks anyways.

Labdabeta 182 Posting Pro in Training Featured Poster

I know that this #define QUOTE(X) #X turns X into a c-string version of whatever is passed to it. my question is if there is a way to do this in reverse ie: #define DEQUOTEANDCALLFUNCTIONORCLASSWITHGIVENNAME(X) (X#)() is this possible?

Labdabeta 182 Posting Pro in Training Featured Poster

Hello, I have been attempting to create a fast class for OpenGL's Vertex Buffer Objects. I finally got all the libraries to work and now i am getting a sigseg but cant see why. Can someone find my error? (I will keep looking too)

#ifndef GLMODELS_H
#define GLMODELS_H
#ifndef GOODGL
typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
PFNGLGENBUFFERSARBPROC glGenBuffersD=(PFNGLGENBUFFERSARBPROC)wglGetProcAddress("glGenBuffersARB");
PFNGLBINDBUFFERARBPROC glBindBufferD=(PFNGLBINDBUFFERARBPROC)wglGetProcAddress("glBindBufferARB");
PFNGLBUFFERDATAARBPROC glBufferDataD=(PFNGLBUFFERDATAARBPROC)wglGetProcAddress("glBufferDataARB");
PFNGLDELETEBUFFERSARBPROC glDeleteBuffersD=(PFNGLDELETEBUFFERSARBPROC)wglGetProcAddress("glDeleteBuffersARB");
#else
    #include <gl/glext.h>
#endif
class glModel
{
    private:
    int numv;
    unsigned int model;
    struct glVertexStructure
    {
        float vert[3];
        float text[2];
        float norm[3];
    };
    glVertexStructure *vars;
    public:
    glModel():numv(0),model(0),vars(0){}
    glModel &Vertex(float tx, float ty, float x, float y, float z);
    glModel &Compile();
    glModel &Draw();
    glModel &Move(float x, float y, float z){glTranslatef(x,y,z);return *this;}
};




glModel &glModel::Vertex(float tx, float ty, float x, float y, float z)
{
    glVertexStructure *temp=new glVertexStructure[numv+1];
    for (int i=0; i<numv; i++)
        temp[i]=vars[i];
    delete[]vars;
    vars=temp;
    temp=NULL;
    vars[numv].vert[0]=x;
    vars[numv].vert[1]=y;
    vars[numv].vert[2]=z;
    vars[numv].text[0]=tx;
    vars[numv].text[1]=ty;
    vars[numv].norm[0]=0.0;
    vars[numv].norm[1]=0.0;
    vars[numv].norm[2]=0.0;
    numv++;
    if (numv%3==0)
    {
        float &zz0=vars[numv-3].vert[2];
        float &zz1=vars[numv-2].vert[2];
        float &zz2=vars[numv-1].vert[2];
        float &yy0=vars[numv-3].vert[1];
        float &yy1=vars[numv-2].vert[1];
        float &yy2=vars[numv-1].vert[1];
        float &xx0=vars[numv-3].vert[0];
        float &xx1=vars[numv-2].vert[0];
        float &xx2=vars[numv-1].vert[0];
        float ox=(yy1-yy0)*(zz2-zz0)-(zz1-zz0)*(yy2-yy0);
        float oy=(zz1-zz0)*(xx2-xx0)-(xx1-xx0)*(zz2-zz0);
        float oz=(xx1-xx0)*(yy2-yy0)-(yy1-yy0)*(xx2-xx0);
        float mag=sqrt(ox*ox+oy*oy+oz*oz);
        ox/=mag;
        oy/=mag;
        oz/=mag;
        vars[numv-1].norm[0]=vars[numv-2].norm[0]=vars[numv-3].norm[0]=ox;
        vars[numv-1].norm[1]=vars[numv-2].norm[1]=vars[numv-3].norm[1]=oy;
        vars[numv-1].norm[2]=vars[numv-2].norm[2]=vars[numv-3].norm[2]=oz;
    }
    return *this;
}
glModel &glModel::Compile()
{
    #ifndef GOODGL
    glGenBuffersD(1,&model);
    glBindBufferD(GL_ARRAY_BUFFER, model);
    glBufferDataD(GL_ARRAY_BUFFER, numv*sizeof(glVertexStructure), vars, GL_STATIC_DRAW);
    #else
    glGenBuffers(1,&model);
    glBindBuffer(GL_ARRAY_BUFFER,model);
    glBufferData(GL_ARRAY_BUFFER, numv*sizeof(glVertexStructure), vars, GL_STATIC_DRAW);
    #endif
    return *this;
}
glModel &glModel::Draw()
{ …
Labdabeta 182 Posting Pro in Training Featured Poster

I have been doing some research... it seems most of the functions rely on wingdi.h gdi.lib and gdi.dll... i have the header and dynamic link library and i have libgdi.a so why am i getting the error?

Labdabeta 182 Posting Pro in Training Featured Poster

Sorry, I am forgetting my forum etiquette. I am using Code::Blocks version 10.05 with mingw compiler (it came w/ the install) it uses .a files. I am using these headers to work w/ OpenGL's Vertex Buffer Objects, I had to refer to help from this forum three times along the way to get the OpenGL headers/libraries working and now it seems something is wrong w/ my windows libraries. THIS IS FRUSTRATING!!! :@

Labdabeta 182 Posting Pro in Training Featured Poster

I have been away from internet connection for awhile. Anyways, I am still having library issues using VBOs. Now the only warning that I am getting is undefined reference to 'XXX@Y' Where XXX is either CreateFont, SelectObject, ChoosePixelFormat, SetPixelFormat, GetObject, DeleteObject, or SwapBuffers and Y is a line number. What is wrong with my library set up and how do I fix it?

Labdabeta 182 Posting Pro in Training Featured Poster

That is certainly a possibility. They do seem to be acting as keywords.

Labdabeta 182 Posting Pro in Training Featured Poster

I just observed an unusual phenomena in my code. I am wondering if anyone can explain it.

void dofunc(int a, int b){a+=b;}
void foo(int near,int far){dofunc(near,far);}//Syntax error, expected primary expression before , and )
void poo(int vnear,int vfar){dofunc(vnear,vfar);}//Compiles fine?
Labdabeta 182 Posting Pro in Training Featured Poster

Ok, I understand (I think and hope) I got rid of all compiling errors, but I am still plagued by the error report. What is wrong now?

class glModel
{
    private:
    int numv;
    unsigned int model;
    struct glVertexStructure
    {
        float vert[3];
        float text[2];
        float norm[3];
    };
    glVertexStructure *vars;
    public:
    glModel():numv(0),model(0),vars(0){}
    glModel &Vertex(float tx, float ty, float x, float y, float z);
    glModel &Compile();
    glModel &Draw();
    glModel &Move(float x, float y, float z){glTranslatef(x,y,z);return *this;}
};




glModel &glModel::Vertex(float tx, float ty, float x, float y, float z)
{
    glVertexStructure *temp=new glVertexStructure[numv+1];
    for (int i=0; i<numv; i++)
        temp[i]=vars[i];
    delete[]vars;
    vars=temp;
    temp=NULL;
    vars[numv].vert[0]=x;
    vars[numv].vert[1]=y;
    vars[numv].vert[2]=z;
    vars[numv].text[0]=tx;
    vars[numv].text[1]=ty;
    vars[numv].norm[0]=0.0;
    vars[numv].norm[1]=0.0;
    vars[numv].norm[2]=0.0;
    numv++;
    if (numv%3==0)
    {
        float &zz0=vars[numv-3].vert[2];
        float &zz1=vars[numv-2].vert[2];
        float &zz2=vars[numv-1].vert[2];
        float &yy0=vars[numv-3].vert[1];
        float &yy1=vars[numv-2].vert[1];
        float &yy2=vars[numv-1].vert[1];
        float &xx0=vars[numv-3].vert[0];
        float &xx1=vars[numv-2].vert[0];
        float &xx2=vars[numv-1].vert[0];
        float ox=(yy1-yy0)*(zz2-zz0)-(zz1-zz0)*(yy2-yy0);
        float oy=(zz1-zz0)*(xx2-xx0)-(xx1-xx0)*(zz2-zz0);
        float oz=(xx1-xx0)*(yy2-yy0)-(yy1-yy0)*(xx2-xx0);
        float mag=sqrt(ox*ox+oy*oy+oz*oz);
        ox/=mag;
        oy/=mag;
        oz/=mag;
        vars[numv-1].norm[0]=vars[numv-2].norm[0]=vars[numv-3].norm[0]=ox;
        vars[numv-1].norm[1]=vars[numv-2].norm[1]=vars[numv-3].norm[1]=oy;
        vars[numv-1].norm[2]=vars[numv-2].norm[2]=vars[numv-3].norm[2]=oz;
    }
    return *this;
}
glModel &glModel::Compile()
{
    glGenBuffers(1,&model);
    glBindBuffer(GL_ARRAY_BUFFER, model);
    glBufferData(GL_ARRAY_BUFFER, numv*sizeof(glVertexStructure), vars, GL_STATIC_DRAW);
    return *this;
}
glModel &glModel::Draw()
{
    int numt=numv-numv%3;
    if (numt==0)
        return *this;
    glBindBuffer(GL_ARRAY_BUFFER,model);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3,GL_FLOAT,sizeof(glVertexStructure),0);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glTexCoordPointer(2,GL_FLOAT,sizeof(glVertexStructure),(void*)((char*)(NULL)+sizeof(float)*(&(vars[0].text[0])-&(vars[0].vert[0]))));
    glEnableClientState(GL_NORMAL_ARRAY);
    glNormalPointer(GL_FLOAT,sizeof(glVertexStructure),(void*)((char*)(NULL)+sizeof(float)*(&(vars[0].norm[0])-&(vars[0].vert[0]))));
    glDrawArrays(GL_TRIANGLES, 0, 3*numt);
    return *this;
}
Labdabeta 182 Posting Pro in Training Featured Poster

I understand that, the issue is that my glTexCoordPointer does not seem to take info from the GL_ARRAY_BUFFER as it requires I specify an array. Also it does not allow me to give it an offset. I cannot think of how to do this without using multiple temporary arrays.

Labdabeta 182 Posting Pro in Training Featured Poster

I got a problem, it seems we are using different headers as my headers define glTexCoord as:

GLAPI void APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr );

This means that your code uses invalid arguments. How do I modify your code to fix this?

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you, still working on the extra implementation so haven't tested yet, but I am hopeful.

P.S.: IMO line 19 is useless but as a quote from my model makers "Model.Draw().Move().Draw().Move().Draw() will make drawing recurring shapes easier and faster!"

Labdabeta 182 Posting Pro in Training Featured Poster

I have reinstalled my compiler successfully (finally) and got right back to work. I have created a glModel class as follows:

class glModel
{
    private:
    int numv;
    int numn;
    unsigned int model;
    unsigned int textu;
    unsigned int norma;
    float *vars;
    float *norm;
    public:
    glModel():numv(0),numn(0){vex=new float[1];tex=new float[1];nex=new float[1];}
    glModel& Vertex(float tx, float ty, float x, float y, float z);
    glModel& Compile();
    glModel& Draw();
    glModel& Move(float x, float y, float z){glTranslatef(x,y,z);}
};
glModel &glModel::Vertex(float tx, float ty, float x, float y, float z)
{
    float *temp=new float[numv*5];
    for (int i=0; i<numv*5; i++)
        temp[i]=vars[i];
    delete[]vars;vars=NULL;
    vars=new float[numv*5+5];
    for (int i=0; i<numv*5; i++)
        vars[i]=temp[i];
    vars[numv*5]=tx;
    vars[numv*5+1]=ty;
    vars[numv*5+2]=x;
    vars[numv*5+3]=y;
    vars[numv*5+4]=z;
    delete[]temp;temp=NULL;
    numv++;
    if (numv%3==0)
    {
        temp=new float[numn*3];
        for (int i=0; i<numn*3; i++)
            temp[i]=norm[i];
        delete[]norm;norm=NULL;
        norm=new float[numn*3+3];
        for (int i=0; i<numn*3; i++)
            norm[i]=temp[i];
        delete[]temp;temp=NULL;
        float x1,x2,x3,y1,y2,y3,z1,z2,z3;
        z3=vars[numn*5-1];
        y3=vars[numn*5-2];
        x3=vars[numn*5-3];
        z2=vars[numn*5-6];
        y2=vars[numn*5-7];
        x2=vars[numn*5-8];
        z1=vars[numn*5-11];
        y1=vars[numn*5-12];
        x1=vars[numn*5-13];
        float dx1,dx2,dy1,dy2,dz1,dz2;
        dx1=x2-x1;
        dx2=x3-x1;
        dy1=y2-y1;
        dy2=y3-y1;
        dz1=z2-z1;
        dz2=z3-z1;
        float ox,oy,oz;
        ox=dy1*dz2-dz1*dy2;
        oy=dz1*dx2-dx1*dz2;
        oz=dx1*dy2-dy1*dx2;
        float mag=sqrt(ox*ox+oy*oy+oz*oz);
        ox/=mag;
        oy/=mag;
        oz/=mag;
        norm[numn*3]=ox;
        norm[numn*3+1]=oy;
        norm[numn*3+2]=oz;
        numn++;
    }
    return *this;
}
glModel &glModel::Compile()
{
    float *temp=new float[numv*3];
    for (int i=0; i<numv; i++)
    {
        temp[i*3]=vars[i*5+2];
        temp[i*3+1]=vars[i*5+3];
        temp[i*3+2]=vars[i*5+4];
    }
    glGenBuffers(1,&model);
    glBindBuffer(GL_ARRAY_BUFFER, model);
    glBufferData(GL_ARRAY_BUFFER, numv*3*sizeof(float), temp, GL_STATIC_DRAW);
    delete[]temp;temp=NULL;
    temp=new float[numv*2];
    for (int i=0; i<numv; i++)
    {
        temp[i*2]=vars[i*5];
        temp[i*2+1]=vars[i*5+1];
    }
    glGenBuffers(1,&textu);
    glBindBuffer(GL_ARRAY_BUFFER, textu);
    glBufferData(GL_ARRAY_BUFFER, numv*2*sizeof(float), temp, GL_STATIC_DRAW);
    delete[]temp;temp=NULL;
    glGenBuffers(1,&norma);
    glBindBuffer(GL_ARRAY_BUFFER, norma);
    glBufferData(GL_ARRAY_BUFFER, numn*3*sizeof(float), norm, GL_STATIC_DRAW);
    return *this;
}
glModel& glModel::Draw()
{
    glBindBuffer(GL_ARRAY_BUFFER, model);
    glVertexPointer(3, GL_FLOAT, 0, NULL);
    glBindBuffer(GL_ARRAY_BUFFER, textu);
    glTexCoordPointer(2, GL_FLOAT, 0, NULL);
    glBindBuffer(GL_ARRAY_BUFFER, norma);
    glNormalPointer(GL_FLOAT, 0, NULL);
    glDrawArrays(GL_TRIANGLE,0,numv);
    return *this;
}

This class is designed to be used …

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you!

Labdabeta 182 Posting Pro in Training Featured Poster

I am making a program and I want to be able to determine the refresh rate of the monitor somehow (to limit an fps cap). I am using windows API. Is there anyway to access this?

Labdabeta 182 Posting Pro in Training Featured Poster

Thanks that answers it!

Labdabeta 182 Posting Pro in Training Featured Poster

Just wondering which of these functions would be faster (or if they would be the same):

class MyClass
{
    private:
    bool MyVar;
    public:
    MyClass &Function1(bool MyVar);
    MyClass &Function2(bool MyVar);
    MyClass &Function3(bool var);
};
MyClass &MyClass::Function1(bool MyVar)
{
    this->MyVar=MyVar;
    cout<<MyVar;
    return *this;
}
MyClass &MyClass::Function2(bool MyVar)
{
    this->MyVar=MyVar;
    cout<<this->MyVar;
    return *this;
}
MyClass &MyClass::Function3(bool var)
{
    MyVar=var;
    cout<<MyVar;
    return *this;
}
Labdabeta 182 Posting Pro in Training Featured Poster

I just got a reply from the C::B forums... the problem was with my toolchain executables.

Labdabeta 182 Posting Pro in Training Featured Poster

Code::Blocks isn't working. I recently reinstalled to get a newer version and when I hit build I get the following error:

mingw32-g++.exe -Wall  -g    -I"C:\Program Files\CodeBlocks\MinGW\include"  -c D:\Programming\C++\TESTINGOPENGL\main.cpp -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall  -g    -I"C:\Program Files\CodeBlocks\MinGW\include"  -c D:\Programming\C++\TESTINGOPENGL\main.cpp -o obj\Debug\main.o' in 'D:\Programming\C++\TESTINGOPENGL' failed.

Please help!

Labdabeta 182 Posting Pro in Training Featured Poster

I looked all over that forum, tried everything they suggested and still I get the same problem. When I hit just build I get this message in the build log section:

-------------- Build: Debug in test ---------------

mingw32-g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c D:\Programming\C++\test\main.cpp -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall -g -I"C:\Program Files\CodeBlocks\MinGW\include" -c D:\Programming\C++\test\main.cpp -o obj\Debug\main.o' in 'D:\Programming\C++\test' failed.
Nothing to be done.

Please help me... I haven't done any programming in over a week. :'(

Labdabeta 182 Posting Pro in Training Featured Poster

Please help, I cannot program at all!

Labdabeta 182 Posting Pro in Training Featured Poster

I reinstalled and whenever I press the 'Build and Run' button I get this popup in an infinite loop: "It seems this project has not been built yet. Do you what to build it now?" and everytime i press "yes" it shows the same popup. How do I fix this?

Labdabeta 182 Posting Pro in Training Featured Poster

Please help nothing I do works!!! None of my projects will compile!!! :O

Labdabeta 182 Posting Pro in Training Featured Poster

I used learncpp.com, it is an excellent starting point. By the end of the tutorials you should know all of the advanced syntax of standard c++.

Labdabeta 182 Posting Pro in Training Featured Poster

Ok I installed the new MinGW and when I try to build my project I get this error:

Linking executable: bin\Debug\OPENGLTEST.exe
Execution of 'mingw32-g++.exe -L..\..\CodeBlocks\MinGW\lib -LD:\Programming\CodeBlocks\MinGW\MinGW\lib  -o bin\Debug\OPENGLTEST.exe obj\Debug\test1.o   -lopengl32 -lglu32 -lglaux -lopengl32 -lglu32 -lglaux  ..\..\CodeBlocks\MinGW\lib\libglaux.a ..\..\CodeBlocks\MinGW\lib\libglu32.a ..\..\CodeBlocks\MinGW\lib\libopengl32.a D:\Programming\CodeBlocks\MinGW\MinGW\lib\libopengl32.a D:\Programming\CodeBlocks\MinGW\MinGW\lib\libglaux.a D:\Programming\CodeBlocks\MinGW\MinGW\lib\libglu32.a  -mwindows' in 'D:\Programming\C++\OPENGLTEST' failed.
Nothing to be done.

What now?

Labdabeta 182 Posting Pro in Training Featured Poster

That would seem to be the problem, I am using MinGW version 3.4.5. The issue is that I am using Code::Blocks 8.02 and for some reason I really hate the newer versions (I can't stand the sprites :P) Anyways could you tell me how to install a newer version of MinGW and link? it with my version of Code::Blocks?

Labdabeta 182 Posting Pro in Training Featured Poster

That is a problem though since it wont link and my libopengl32.a file is working fine. I guess my headers are out of date with my libraries? How do I fix this?

P.S.: This VBO stuff had better be worth all this effort :P

Labdabeta 182 Posting Pro in Training Featured Poster

Thank you!

Labdabeta 182 Posting Pro in Training Featured Poster

Le Update, I re-downloaded the glext.h file and my functions are there... but now I don't have the library to link to. Where can I find the library for glext?

Labdabeta 182 Posting Pro in Training Featured Poster

I need to make a function:

void GenerateNormal(float x[3], float y[3], float z[3], float &ox, float &oy, float &oz)
{
    //Calculate coordinates for a glNormal and return them ox,oy and oz
}

I have a sinking feeling that the math will be quite difficult. Can anybody help me?

Labdabeta 182 Posting Pro in Training Featured Poster

I looked at all of my GL headers, they are all version 4.0 and none of them contain any of the functions I need? Why am I missing these functions?

Labdabeta 182 Posting Pro in Training Featured Poster

I have version 4.0 I have gl.h and glu.h and glext.h included. All my libraries are properly linked. What am I missing?

Labdabeta 182 Posting Pro in Training Featured Poster

I don't see anything wrong. I would suggest for good practice also setting your pointers to null when you deallocate them. I sometimes like to define delarr in a preprocessor macro:

#define delarr(X) (delete[](X));((X)=0)

Hope this helps. (Also I may be wrong so more people should check as well)

Labdabeta 182 Posting Pro in Training Featured Poster

I tried using the non-arb versions, it said that they were all not declared in the scope. Are VBOs really worth the trouble? and if so could you give me some simple sample code to make a short VBO display, say, a triangle?

Labdabeta 182 Posting Pro in Training Featured Poster
while (!f.fail())
{
    cin>>integervalue;
}
Labdabeta 182 Posting Pro in Training Featured Poster

Here is what I got from http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E/...
I think that you should just input to the int and then check if the failbit was set (you can do this using the fail() function).

Labdabeta 182 Posting Pro in Training Featured Poster

Calm down... the answer to your question is to TRY IT! if you try it you will find that either it works... or it doesn't.

Labdabeta 182 Posting Pro in Training Featured Poster

You are comparing your integer to X. What is X? In this program it is not set as anything.

Labdabeta 182 Posting Pro in Training Featured Poster

just remove the cin.ignore() it is saying "forget the first thing that the user enters" you don't want that.

Labdabeta 182 Posting Pro in Training Featured Poster

Ok, I got something that isn't giving me errors at compile time, just at runtime. Can anybody see the problem with this class:

#define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_STATIC_DRAW_ARB 0x88E4
typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
PFNGLGENBUFFERSARBPROC glGenBuffersARB = (PFNGLGENBUFFERSARBPROC) wglGetProcAddress("glGenBuffersARB");
PFNGLBINDBUFFERARBPROC glBindBufferARB = (PFNGLBINDBUFFERARBPROC) wglGetProcAddress("glBindBufferARB");
PFNGLBUFFERDATAARBPROC glBufferDataARB = (PFNGLBUFFERDATAARBPROC) wglGetProcAddress("glBufferDataARB");
PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) wglGetProcAddress("glDeleteBuffersARB");
class glModel
{
    private:
    unsigned int model;
    unsigned int textu;
    unsigned int norma;

    int numargs;
    float *vex;
    float *tex;
    float *nex;
    public:
    glModel():numargs(0){}
    glModel& Vertex(float tx, float ty, float x, float y, float z);
    void Compile();
    void Draw();
};
glModel& glModel::Vertex(float tx, float ty, float x, float y, float z)//normals will be auto generated every 3 triangles
{
    float *tvex=new float[numargs*3];
    float *ttex=new float[numargs*2];
    for (int i=0; i<numargs*3; i++)
        tvex[i]=vex[i];
    for (int i=0; i<numargs*2; i++)
        ttex[i]=tex[i];
    delete[]vex;vex=0;
    delete[]tex;vex=0;
    vex=new float[numargs*3+3];
    tex=new float[numargs*2+2];
    for (int i=0; i<numargs*3; i++)
        vex[i]=tvex[i];
    for (int i=0; i<numargs*2; i++)
        tex[i]=ttex[i];
    vex[numargs*3]=x;
    vex[numargs*3+1]=y;
    vex[numargs*3+2]=z;
    tex[numargs*2]=tx;
    tex[numargs*2+1]=ty;
    delete[]tvex;tvex=0;
    delete[]ttex;ttex=0;
    numargs++;
    return *this;
}
void glModel::Compile()
{
    glGenBuffersARB(1,&model);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, model);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, numargs*3*sizeof(float), vex, GL_STATIC_DRAW_ARB);
    glGenBuffersARB(1,&textu);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, textu);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, numargs*3*sizeof(float), tex, GL_STATIC_DRAW_ARB);
}
void glModel::Draw()
{
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, model);
    glVertexPointer(3,GL_FLOAT,0,NULL);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, textu);
    glTexCoordPointer(2,GL_FLOAT,0,NULL);
    glDrawArrays(GL_TRIANGLES,0,numargs);
}
Labdabeta 182 Posting Pro in Training Featured Poster

I have a problem, I tried making some code to use VBOs and I am getting errors about the ARB functions. They all say ...ARB was not declared in this scope. Am I missing a library? A header?

Labdabeta 182 Posting Pro in Training Featured Poster

I just looked at VBOs, and they look good, except it doesn't look as though I can bind textures to them? Is it possible to bind textures to VBOs?

Labdabeta 182 Posting Pro in Training Featured Poster

From what I can tell your error might be that

while (t.End())

may never be false as it may only be abnorm or norm, which could be true or false. Try:

while (t.End()!=abnorm)

Of course you will need the End() function to return a Status, not a bool.

Labdabeta 182 Posting Pro in Training Featured Poster

Ill try to help, but please put CODE tags around your code so I can read it.