Jump to content
  • Advertisement

Mr.A

Member
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

175 Neutral

About Mr.A

  • Rank
    Member
  1. Hello! So just a couple of days ago, I've released my first android game on play store: https://play.google.com/store/apps/details?id=com.a_superlab.a_ping&hl=en Screenshots: https://lh3.googleusercontent.com/ihtBHz1s47-t3-vnMo9RB-cEB0EetmqRn6iS9lXs0sdxaTwhbEUTdE_yIckq0CikXg=h900 https://lh3.googleusercontent.com/cPLkCYn2qR7kWfu65Q6nE29hVyWgflE6qLj-wVUYOaulybQYiQ_w5xPGGN3__n-SHQ=h900 https://lh3.googleusercontent.com/wkr8-XkIcTqwfCA4_CwbS0__Jse_Wc1tTZYM1gSSY_wvUfelQgGnpuN6ioGyucvf3w=h900 https://lh3.googleusercontent.com/y4BKOVpfGylcxHewPrBNaO4LjjIB3GpXRzLpYQkJn_pCymPuflNJu6R_OPBpEW8HJhg=h900     Description: A lot of Pong inspired games have been developed since the game's original debut in 1972 by ATARI, but this one is pretty different! A-dvanced Pong emphasizes on a competitive fast-paced gameplay and allows you to play against 4 types of computer AI. The game also comes with an exciting new mode: The 3-Ball Challenge, where you get to play a 1-man squash-like survival mode with 3 balls moving at once! Challenge your friends and see who will score and rank more in the online leader boards! Share the game now with friends, and don't forget to rate! Features: -Play against 4 computer AIs with different difficulty levels: Warm up, Challenging, Formidable and BACK OFF. -New 3-Ball Challenge mode with addicting gameplay -Online global leader boards to challenge yourself, your friends and the world. The game therefore requires access to the leader board's network. -Unique scoring rules where the difference between goals and not the goal count itself that decides a winner. -A new "Power Shot" mechanic. -Supports Vibration. The game therefore requires vibration permission. I am not sure why, but the install rates are far less than what I expected. Any advice regarding the matter would really be appreciated. I am hoping I could get critics on this. Especially regarding the first impression it makes, and what I can do to improve that.     Thank you in advance!
  2. Aha! I see. To make sure I understood:   -Vertex Shader operates: 1.It is being looped on every vertex. 2.Colors (and transformations) are set for each vertex. 3.Rasterization and the other stuff happens. 4.Interpolation happens; every pixel formed in the primitive is given a "mixed" color value resulted from its distance to each vertex, and these values are stored somewhere.   -Fragment Shader operates: 1.It is being looped on every pixel/fragment of the primitive. 2.The color of the fragment that is being worked on is calculated.     That raise few other questions :P : 2-So I think I understand the way stuff flows. But what if what we're dealing with a texture and no interpolated values? And where can I access these values? I've failed to even produce a minimalist shader that renders a texture on the screen. Can someone link me to an example that replicates the original fixed pipe line? I've been looking for such for a couple of days now but with no avail.   3-So varyings are old fashioned. I assume the new way of doing things is attributes and the "in"s and "out"s, and using them mean I will be using a higher version of GLSL which requires newer graphics card. How high can I get with the version without affecting its availability to users? The newest version would probably require top-notch graphics cards, so it wouldn't be wise to adopt it already, would it?   4-I've read about shaders that does stuff like blur. The thing is that blur usually requires one to draw extra pixels to the scene. How is that possible using shaders? I remember I read somewhere that shaders can't add vertices nor fragments to a primitive; just edit the existing values.   Sorry for all these questions. I just couldn't find a tutorial that goes through all these details. Most shader tutorials out there just explain how lighting is done in shaders, or how to do shaders that draw everything in one color; ignoring the key-facts that has to do with how values are sent between the OpenGL application and the shader program in the first place. If you know any proper guide I should check out, then please let me know.
  3. Questions on shaders: 1-I understand that "varying" types are shared between the vertex and the fragment shaders. But assuming the vertex shader does its work on each of the  vertices before the fragment shader is called at all, does this mean that what is going to be stored in the "varying" for the fragment shader will be the value the vertex shader stored in it during its operation on the last vertex? (most commonly the bottom right vertex?)  
  4. Simply revert the top and the bottom values: auto projmat = glm::ortho<float>(0.0f, window.width, window.height, 0.0f, 0.0f, 1000.0f);
  5. It worked! Still not sure why it worked though. https://www.opengl.org/sdk/docs/man3/xhtml/glBufferData.xml According to that page, we should pass a pointer to the function (?).   Edit: So you're saying the pointer to the vector is different from the pointer to the first element in the vector per se? If so, then what data does it point to?   Thanks!
  6. Hello, So I wrote a simple .obj models parser, and attempted to render a simple cube model with indices. Everything seems to be working fine, until I come to render the cube with a glDrawElements() call.. it crashes returning -1073741819. I've been struggling with this for a day now, so I'd really appreciate if you'd help me with this. Here is my code:   Loading the stuff: vector<Vertex> CubeModel, CubeNormals; vector<GLuint> CubeIndices; vector<TexCoord> CubeTexCoords; LoadObjModel("simple cube.obj", CubeModel, CubeTexCoords, CubeNormals, CubeIndices); GLuint CubeId = InitializeVBOs(&CubeModel, 8); GLuint CubeIndicesId = InitializeIBOs( &CubeIndices, 36); The InitializeVBOs/IBOs functions: GLuint InitializeVBOs(std::vector<Vertex> * vertices, int number) {     GLuint VBOid;     glGenBuffers(1, &VBOid);     glBindBuffer(GL_ARRAY_BUFFER, VBOid);     glBufferData(GL_ARRAY_BUFFER, number*sizeof(Vertex), vertices, GL_STATIC_DRAW);     return VBOid; } GLuint InitializeIBOs(vector<GLuint> * indices, int number) {     GLuint IBOid;     glGenBuffers(1, &IBOid);     glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBOid);     glBufferData(GL_ELEMENT_ARRAY_BUFFER, number*sizeof(GLuint), indices, GL_STATIC_DRAW);     return IBOid; } The drawing part: glEnableClientState(GL_VERTEX_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, CubeId); glVertexPointer(3, GL_FLOAT, 0, NULL); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, CubeIndicesId); glDrawElements( GL_TRIANGLES, 36, GL_UNSIGNED_INT, NULL ); //there are 36 indices; 3 for each triangle making half a face glDisableClientState(GL_VERTEX_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); Here is the .obj file content: http://pastebin.com/zcQpy7sR   I am pretty sure the .obj parser works correctly. Feel free to compare the values with the watch values of the arrays (I am aware the indices values are subtracted by 1): Content of "CubeModel" (vertices): http://prntscr.com/68emn7 Content of "CubeIndices": http://prntscr.com/68emcn   If I am missing any other info, let me know and I will provide them immediately. Thanks in advance!
  7. Aha! Everything started to make sense after I checked out the matrices.   This. The parameters aren't at all related to their names (or to anything else I suppose).   Got everything working now. Thanks again!
  8. Go to deviant art, look up some 3D art and offer the artist putting his work into a simple game for him. He'll most probably like seeing his work actually playing in a game, and that might be your chance to ask him if he'd like to work with you on your game. This is how it usually starts.
  9. Thank you very much! #1: glDisable(GL_CULLFACE)? Done. #2: Disabled it for now (since I don't have more than one shape yet). #3: Done. #4: Did already. #5: Did already. #6: 0.1? Did already. #7: The triangle should be 200 pixels wide and high. Shouldn't that be big enough? #8: lol Okay. May I understand what's so special about pink in my case?   You're right. I just tried glGetError() on it and it throws a "1280". Removed it.   #9: Just tried it, and no errors are generated at all.   Here is what I am (still) getting after all this: http://prntscr.com/66kexd   P.S: Updated the first post with an illustration of what I expected.   Edit: And here is my new code: #include <SDL.h> #include <glew.h> #include "SDL_opengl.h" #include <string> #include "Eval.h" /**< stringify(float) -> std::string */ #include <iostream> using namespace std; int main(int argc, char* args[]) { GLenum err; float window_width = 800, window_height = 600; float fps = 30.; SDL_Init( SDL_INIT_EVERYTHING ); int count_time = SDL_GetTicks(); SDL_Window * window = SDL_CreateWindow("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, SDL_WINDOW_OPENGL); /**< Create OpenGL context */ SDL_GL_CreateContext(window); glDisable(GL_CULL_FACE); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glFrustum(0.0f, window_width, 0, window_height, 0.1, window_height); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glClearColor( 1.f, 0.4f, 0.4f, 1.f); //glEnable( GL_TEXTURE_2D ); glViewport(0, 0, window_width, window_height); //glEnable( GL_BLEND ); while ((err = glGetError()) != GL_NO_ERROR) { cerr << "OpenGL error8: " << err << endl; } //glEnable( GL_DEPTH_TEST ); //glDepthFunc(GL_LEQUAL); //glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); while (true) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); /**< Draw triangle */ glBegin(GL_TRIANGLES); glColor4f(1.f, 0.f, 0.f, 1.f); glVertex3f(300, 500, -10.0f); glColor4f(0.f, 1.f, 0.f, 1.f); glVertex3f(500, 500, -10.f); glColor4f(0.f, 0.f, 1.f, 1.f); glVertex3f(300, 300, -10.0f); glEnd(); /**< Flip window */ SDL_GL_SwapWindow( window ); if ( (SDL_GetTicks()-count_time) < (1000./ fps) ) { SDL_Delay((1000./fps) - (SDL_GetTicks()-count_time)); SDL_SetWindowTitle(window, stringify(1000./float(SDL_GetTicks()-count_time)).c_str()); } count_time = SDL_GetTicks(); } } Edit2: Here is what happens when I change "glFrustum" to "glOrtho" with the same parameters: http://prntscr.com/66kg3a (IT DRAWS?! :\)
  10. You're right, and I am aware of that (this is why I include glew in the first place as you mentioned). But here I am just tinkering with 3D, so I thought immediate mode might as well suffice. I am not following a tutorial yet. I am just trying to render a simplest 3D figure on a grid with coordinates of the screen (not the default -1 to 1 system). I'd really appreciate if you can examine this further.
  11. So very basic stuff. I've done 2D OpenGL before, but this is my first go with 3D.   What I am trying to do is render a multicolored triangle to 3D space. I used glFrustum to set my perspective, but it doesn't seem to work as it should, as no triangle is being rendered at all. #include <SDL.h> #include <glew.h> #include "SDL_opengl.h" #include <string> #include "Eval.h" /**< stringify(float) -> std::string */ int main(int argc, char* args[]) { float window_width = 800, window_height = 600; float fps = 30.; SDL_Init( SDL_INIT_EVERYTHING ); int count_time = SDL_GetTicks(); SDL_Window * window = SDL_CreateWindow("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, SDL_WINDOW_OPENGL); /**< Create OpenGL context */ SDL_GL_CreateContext(window); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glFrustum(0.0f, window_width, 0, window_height, 0.1, window_height); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glClearColor( 0.f, 0.f, 0.f, 1.f); glEnable( GL_TEXTURE_2D ); glViewport(0, 0, window_width, window_height); glEnable( GL_BLEND ); glEnable( GL_DEPTH ); glEnable( GL_DEPTH_TEST ); glDepthFunc(GL_LEQUAL); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); while (true) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); /**< Draw triangle */ glBegin(GL_TRIANGLES); glColor4f(1.f, 0.f, 0.f, 1.f); glVertex3f(300, 500, -10.0f); glColor4f(0.f, 1.f, 0.f, 1.f); glVertex3f(500, 500, -10.f); glColor4f(0.f, 0.f, 1.f, 1.f); glVertex3f(300, 300, -10.0f); glEnd(); /**< Flip window */ SDL_GL_SwapWindow( window ); if ( (SDL_GetTicks()-count_time) < (1000./ fps) ) { SDL_Delay((1000./fps) - (SDL_GetTicks()-count_time)); SDL_SetWindowTitle(window, stringify(1000./float(SDL_GetTicks()-count_time)).c_str()); } count_time = SDL_GetTicks(); } } Using glOrtho instead of glFrustum there works just as it should (except without a depth component). What is it that I am doing wrong?   Thanks in advance!   Edit: Here is an illustration of what I expected to happen:
  12. Getting the common segfault with this operator function (the function is really simple. It's just this long because it repeats some conditions.): bool operator() (objcopy * lhs, objcopy * rhs) {     if (lhs->deleteobj&&rhs->deleteobj) //no     {         if (lhs->rndrngpriority!=rhs->rndrngpriority)         {                 return lhs->rndrngpriority > rhs->rndrngpriority;         }         else if (lhs->posz != rhs->posz)         {                 return lhs->posz < rhs->posz;         }         else if (lhs->_universal_id != rhs->_universal_id)             return lhs->_universal_id > rhs->_universal_id;         else             return false;     }     if (!lhs->deleteobj && rhs->deleteobj)     {         return false;     }     if (lhs->deleteobj && !rhs->deleteobj)     {         return true;     }     if (lhs->rndrbackid!=NONE && rhs->rndrbackid!=NONE )     {         if (lhs->rndrngpriority!=rhs->rndrngpriority)         {                 return lhs->rndrngpriority > rhs->rndrngpriority;         }         else if (lhs->posz != rhs->posz)         {                 return lhs->posz < rhs->posz;         }         else if (lhs->_universal_id != rhs->_universal_id)         {             return lhs->_universal_id > rhs->_universal_id;         }         else         {             return false;         }     }     if (lhs->rndrbackid != NONE && rhs->rndrbackid == NONE )     {         return false;     }     if (lhs->rndrbackid == NONE && rhs->rndrbackid != NONE )     {         return true;     }     if (lhs->isbar != rhs->isbar)     {         if (lhs->isbar)             return true;         if (rhs->isbar)             return false;     }             else     {         if (lhs->rndrngpriority!=rhs->rndrngpriority)         {                 return lhs->rndrngpriority > rhs->rndrngpriority;         }         else if (lhs->posz != rhs->posz)         {                 return lhs->posz < rhs->posz;         }         else if (lhs->_universal_id != rhs->_universal_id)         {                 return lhs->_universal_id > rhs->_universal_id;         }         else         {                 return false;         }     } } Each of these objects has a unique "_universal_id" value, and even in case (even though I don't see how that would happen) the object was compared to itself, the function returns false as it should. "NONE" is a magic number which is just interpreted as no value. Thanks in advance!  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!