Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

glCheckFramebufferStatus segfaults on my laptop because the libraries…

… aren't loaded or initialized or something to that effect
  • Loading branch information...
commit f24f1f12416a5cc5d8006d8ccff359128308e12b 1 parent eba3f8a
@ChrisLundquist authored
Showing with 20 additions and 11 deletions.
  1. +3 −2 Driver.cpp
  2. +1 −0  Makefile
  3. +5 −1 Makefile.MacOSX
  4. +11 −8 Obj.cpp
View
5 Driver.cpp
@@ -3,11 +3,13 @@
#endif
#include <GL/glew.h>
#include <GL/glut.h>
+#include <glm/glm.hpp>
#include "Model.h"
#include "Obj.h"
Model::Obj m = Model::Obj();
+
void usage(){
std::cout << "Please specify paths to models" << std::endl;
}
@@ -58,7 +60,6 @@ void display(void) {
}
void printGLError() {
- return;
GLenum fboStatus;
fboStatus = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
std::string error = "";
@@ -125,7 +126,7 @@ int main(int argc, char** argv){
return;
}
*/
- m.load("cube.obj");
+ m.load("cube_cube.obj");
printGLError();
glutMainLoop ();
}
View
1  Makefile
View
6 Makefile.MacOSX
@@ -5,10 +5,14 @@ FRAMEWORKS = -framework GLUT -framework OpenGL
LIBS = -lGLEW
%.o: %.cpp
- $(CC) $(STANDARD) $(CC_FLAGS) -c $<
+ $(CC) $(STANDARD) $(CC_FLAGS) -c -g $<
all: Tokenizer.o Model.o Obj.o Driver.o
$(CC) $(CC_FLAGS) $(FRAMEWORKS) $(LIBS) *.o -o $(APP)
+debug: all
+ $(CC) $(CC_FLAGS) $(FRAMEWORKS) $(LIBS) -g *.o -o $(APP)
+
+
clean:
rm -f *.o $(APP)
View
19 Obj.cpp
@@ -22,7 +22,7 @@ namespace Model {
while (! objFile.eof() ) {
// Get the next line
- getline (objFile,line);
+ getline(objFile,line);
// Split on space characters
Tokenizer tokenizer(line," ");
// while we have tokens on this line
@@ -35,9 +35,10 @@ namespace Model {
// Line is a face
parseFace(tokenizer);
} else if (lineType == "#") {
- // Line is a comment
+ break;
} else {
std::cout << "Unhandled line: " << line << std::endl;
+ break;
}
}
}
@@ -61,12 +62,14 @@ namespace Model {
}
void Obj::parseFace(Tokenizer& tokenizer){
- int vertexNumber[3] = { 0, 0, 0 };
-
- for(int i = 0; i < 3; ++i){
- tokenizer.NextToken();
- if(from_string<int>(vertexNumber[i],tokenizer.GetToken(),std::dec)){
- triangles->push_back(vertices->at( vertexNumber[i]- 1));
+ // The index of the vertex to build this face. This will be over written N times
+ // once for each vertex in the face
+ int vertexNumber;
+
+ while(tokenizer.NextToken()){
+ if(from_string<int>(vertexNumber,tokenizer.GetToken(),std::dec)){
+ // -1 because OBJ spec counts from 1
+ triangles->push_back(vertices->at( vertexNumber - 1));
}
else
std::cerr << "Error parsing token into face component: " << tokenizer.GetToken() << std::endl;
Please sign in to comment.
Something went wrong with that request. Please try again.