Go to advanced search

by Hardcheese
Fri Jan 11, 2013 5:59 pm
Forum: C/C++
Topic: Segmentation fault when opening file.
Replies: 5
Views: 2228

Re: Segmentation fault when opening file.

Thanks for your replies. From running the program under gdb as PeterO suggested the problem originates from the strlen() function call in a function which is referenced by a function mopen calls called adjust_file_path i'll post the code here for those two functions: void adjust_file_path( char *fil...
by Hardcheese
Fri Jan 11, 2013 4:13 pm
Forum: C/C++
Topic: Segmentation fault when opening file.
Replies: 5
Views: 2228

Segmentation fault when opening file.

Hi, I am having trouble when loading files from the disk because I keep getting 'Segmentation fault' errors which I know is something to do with the memory and I have narrowed it down to this function in my code: MEMORY *mopen( char *filename, unsigned char relative_path ) { FILE *f; char fname[ MAX...
by Hardcheese
Tue Dec 25, 2012 6:53 pm
Forum: OpenGLES
Topic: Object Disappearance with rotation
Replies: 12
Views: 2711

Re: Object Disappearance with rotation

Hi fxmaker,

Thanks for those tips although I can't use GLM because I am using C as most of the examples are written in C. I don't think there is a plain C interface for GLM but I might be wrong.
by Hardcheese
Sun Dec 23, 2012 5:19 pm
Forum: OpenGLES
Topic: Object Disappearance with rotation
Replies: 12
Views: 2711

Re: Object Disappearance with rotation

Ahh yeh sorry about that I experienced the whole reboot thing a few times it is dependent on the SDL code working properly so you can press the escape button to exit and you can't press ctrl - C to exit.

I haven't even got white pixels on mine it's just blank and I don't know why.
by Hardcheese
Sun Dec 23, 2012 1:21 pm
Forum: OpenGLES
Topic: Object Disappearance with rotation
Replies: 12
Views: 2711

Re: Object Disappearance with rotation

Are you saying that it runs without the SDL errors now?
by Hardcheese
Sun Dec 23, 2012 12:49 pm
Forum: OpenGLES
Topic: Object Disappearance with rotation
Replies: 12
Views: 2711

Re: Object Disappearance with rotation

The SDL code works perfectly on my pi so maybe you could just do an apt-get install libsdl-dev or something to make it work.
by Hardcheese
Sun Dec 23, 2012 12:41 pm
Forum: OpenGLES
Topic: Object Disappearance with rotation
Replies: 12
Views: 2711

Re: Object Disappearance with rotation

You can remove all the SDL code and it would still work that is just for keyboard input.
by Hardcheese
Sun Dec 23, 2012 12:10 pm
Forum: OpenGLES
Topic: Object Disappearance with rotation
Replies: 12
Views: 2711

Object Disappearance with rotation

Hi, Very recently I posted a question on transformations this is pretty much the same but I think I might be quite close to success after hunting around on the net although something must be going wrong because the rendered object disappears when I run the program. Here is the draw function: void Dr...
by Hardcheese
Fri Dec 21, 2012 2:13 pm
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Re: Transformations

Sorry but I have encountered trouble again! For my game I need rotations as well as translations but I don't know how to implement them (even though I now have the translations working well). What would I have to add to make a rotation?
by Hardcheese
Fri Dec 21, 2012 7:48 am
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Re: Transformations

Thank you so much PeterO :D it all works.
by Hardcheese
Thu Dec 20, 2012 7:41 pm
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Re: Transformations

Here is the code.
by Hardcheese
Thu Dec 20, 2012 7:22 pm
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Re: Transformations

Although I haven't tried to implement the translations yet I am quite concerned that nothing is drawn on the screen now I have implemented the new shader code (although it compiles correctly). I am using the following code for drawing. void Draw(void) { update_keys(); //Start listening for keyboard ...
by Hardcheese
Thu Dec 20, 2012 6:59 pm
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Re: Transformations

When I try to compile your shader code the compiler complains of the following line saying one of the variables is undefined:

Code: Select all

 gl_Position = u_mvpMatrix * posn ;
Also what would you have to put into your main C code to make this work?
by Hardcheese
Thu Dec 20, 2012 6:45 pm
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Re: Transformations

Thanks for the reply. The problem is i am using plain C (as most of the tutorials seem to use it) and it seems glm is a C++ library. Is there a way you could do all this manually?
by Hardcheese
Thu Dec 20, 2012 5:32 pm
Forum: OpenGLES
Topic: Transformations
Replies: 17
Views: 3481

Transformations

Hi, I was wondering how you would do this in OpenGL ES 2.0 because I can't seem to be able to get anything to move around on screen when I try to use the glTranslatef(.., .., ...). I read online that you would have to bind your custom matrices to the shaders uniform, I unfortunately don't know what ...
by Hardcheese
Tue Oct 16, 2012 7:29 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

If you want to see my EGL set up then just download the Penguins Puzzle source I copied the EGL code from there. I'm not even sure whether I should be seeing something yet as I haven't dealt with textures yet (That'll be another complicated adventure). I modified part of the loop so all the data was...
by Hardcheese
Tue Oct 16, 2012 6:29 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

I'm not sure whether you should see something immediately when you draw the vertices but I can't see anything at the moment. Here is the code I have been using: void draw_object(char *name, SHADER_T *shader) { char *memory = NULL; size_t bytes = ObjLoadFile("enemy.obj", &memory); //Load the file int...
by Hardcheese
Mon Oct 15, 2012 7:41 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

Yes, I know the number of triangles. The problem is that I am using C and I can't access the array outside the loop if I declare it in the loop.
by Hardcheese
Mon Oct 15, 2012 7:04 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

I'm not sure whether it's just me being stupid but it seems incredibly difficult to convert the arrays into one continuous array without the use of dynamic arrays.
by Hardcheese
Mon Oct 15, 2012 5:12 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

I have the vertex data in an array. For example if you wanted face 3 vertex 2 to retrieve it you would use the following code:

Code: Select all

model->TriangleArray[3].Vertex[1]
How do I pass that data to OpenGL ES and then draw the vertices.
by Hardcheese
Sun Oct 14, 2012 1:03 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

Okay, thanks for your help. I'll see what I can do in terms of writing my own. My models obj file also comes with a file format called mtl included by the obj file. Will that complicate matters?
by Hardcheese
Sat Oct 13, 2012 10:34 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

All those books listed look as though they would be good for OpenGL but OpenGL ES is quite different to OpenGL from my experience.
by Hardcheese
Sat Oct 13, 2012 4:11 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

After doing a bit of searching around I have found that it is incredibly complicated to load obj files in Opengl ES as there is no easy function to do it. I guess what I need is a full code sample which would allow me to load the obj files so I can use them and then draw the vertices, I know this is...
by Hardcheese
Sat Oct 13, 2012 3:03 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

Once you have the .obj file containing all the vertices how do you compile your code with it? Also when you pass the argument &Model is that the obj file you are passing? How do you make sure your code has access to the obj file and can draw its vertices? Sorry, this has confused me a bit. Thanks fo...
by Hardcheese
Sat Oct 13, 2012 9:04 am
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6556

Re: Creating 3D characters and making textures

The model is in .blend format. Would you need to convert it to object code to use it if so how?

Go to advanced search