So I'm teaching myself OpenGL ES since I want to use it in Android game development. Prolem is... I over-analyze things, thus I keep questioning myself about whether I'm thinking about things the right way.
I started my endeavor by doing a simple 3D cube from the book "Hello, Android!" - the base elements of which I am expanding upon for the sake of learning OpenGL stuffs. Now, the lesson required me to create a cube - GLCube was the class name, a renderer - GLRenderer, which implements GLSurfaceView.Renderer, and a new view - GLView which extends GLSurfaceView.
For the lesson I followed I declared a GLCube in the GLRenderer class and handled that, but I thought... if I was going to use OpenGL for games, I gotta handle things differently - time to experiment with different ideas. For the sake of extending that which I've already done, I instead of declaring a GLCube in the GLRenderer class declared a linked list object that takes in GLCubes, put in a function that takes in GLCube objects, and pushes them onto the linked list I created. I then changed my onDrawFrame function so it didn't do anything if the linked list was empty, and if it was not empty, called the draw function for my GLCube class, pops that off the linked list, and rinse/repeat until the linked list is empty, that way it only draws/renders objects that need to be - which will be pushed onto the linked list when updated in such a way where re-drawing them is required.
Obviously if I were to do serious game development, the linked list would take whatever type[s] I want rendered, again I'm only extending what I've learned so far, but I wonder if my thought processes are at the least on the right path/track. I mean, reducing onDrawFrame's behavior to when it has stuff to draw, making it so you add objects for it to draw seems like a logical step - and more efficient than what I started with, but again I over analyze the shit out of things since this is not so much learning OpenGL as an issue with program structure that IMO at least partially comes from how it is explained.
I started my endeavor by doing a simple 3D cube from the book "Hello, Android!" - the base elements of which I am expanding upon for the sake of learning OpenGL stuffs. Now, the lesson required me to create a cube - GLCube was the class name, a renderer - GLRenderer, which implements GLSurfaceView.Renderer, and a new view - GLView which extends GLSurfaceView.
For the lesson I followed I declared a GLCube in the GLRenderer class and handled that, but I thought... if I was going to use OpenGL for games, I gotta handle things differently - time to experiment with different ideas. For the sake of extending that which I've already done, I instead of declaring a GLCube in the GLRenderer class declared a linked list object that takes in GLCubes, put in a function that takes in GLCube objects, and pushes them onto the linked list I created. I then changed my onDrawFrame function so it didn't do anything if the linked list was empty, and if it was not empty, called the draw function for my GLCube class, pops that off the linked list, and rinse/repeat until the linked list is empty, that way it only draws/renders objects that need to be - which will be pushed onto the linked list when updated in such a way where re-drawing them is required.
Obviously if I were to do serious game development, the linked list would take whatever type[s] I want rendered, again I'm only extending what I've learned so far, but I wonder if my thought processes are at the least on the right path/track. I mean, reducing onDrawFrame's behavior to when it has stuff to draw, making it so you add objects for it to draw seems like a logical step - and more efficient than what I started with, but again I over analyze the shit out of things since this is not so much learning OpenGL as an issue with program structure that IMO at least partially comes from how it is explained.
This post has been edited by Travelsonic: 08 April 2014 - 10:02 AM


00