Thread: OpenGL

  1. #1
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    102

    Post OpenGL

    Anyone familiar with opengl ?

    OpenGL-balls-png

    I am able to read the vertices and indices in from the file (in the picture you can see the white spheres) and draw using glDrawElements. When i import the data from an object and plug in the arrays the object has connected points that shouldn't be (blue background and red spheres are opengl output). The extra connected points are also flickering.
    Last edited by Structure; 1 Week Ago at 08:51 AM.


  2. #2
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    102
    OpenGL-cone-png
    Last edited by Structure; 1 Week Ago at 08:58 AM.


  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,719
    You're obviously doing something wrong at either the loading or the rendering phase. Without code, we can just guess.
    Devoted my life to programming...

  4. #4
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    102

    Post

    either the loading or the rendering phase
    both, i solved the rendering phase problem.

    OpenGL-nolines-png

    I was passing the wrong type of value to glDrawElements().

    As far as the loading phase goes I'm still converting .obj files faces to all triangles and hopefully that solves the problem with the cone.

    OpenGL-outcone-png

    All the flickering is gone and most of the triangles are drawn now. But if you take a look from the inside of the cone...

    OpenGL-incone-png

    I believe this is an issue with the loading phase because i have not solved all the triangles from the faces when the faces have more than 4 vertices.
    Last edited by Structure; 1 Week Ago at 03:07 PM.


  5. #5
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    102

    Cool

    OpenGL-cone10-png


  6. #6
    Registered User
    Join Date
    Feb 2019
    Posts
    471
    OpenGL-cone10-png

  7. #7
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    102
    The extra triangles appear before i triangulated the polygons. Not sure why ... ?


  8. #8
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    102
    Code:
    void tris_indiced(float mesh[],int meshSize,unsigned int indices[],int indiceSize) {
      glBufferData(GL_ARRAY_BUFFER, meshSize, mesh, GL_DYNAMIC_DRAW);
      glBufferData(GL_ELEMENT_ARRAY_BUFFER, indiceSize, indices, GL_DYNAMIC_DRAW);
      glDrawElements(GL_TRIANGLES, indiceSize/sizeof(indices[0]), GL_UNSIGNED_INT, NULL );
    };
    Code:
    render() {
      glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
      tris_indiced(sphere_vertices,sizeof(sphere_vertices),sphere_indices,sizeof(sphere_indices) );
    };


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-02-2010, 01:26 PM
  2. OpenGL Quesiton: Does Windows XP, Vista still at OpenGL 1.1?
    By indigo0086 in forum Game Programming
    Replies: 8
    Last Post: 05-21-2007, 11:18 AM
  3. new to opengl
    By Darkinyuasha1 in forum Game Programming
    Replies: 8
    Last Post: 11-06-2006, 06:13 PM
  4. Replies: 5
    Last Post: 02-12-2006, 08:42 PM
  5. OpenGL, texturing...and...more OpenGL
    By Sunny in forum Game Programming
    Replies: 2
    Last Post: 07-08-2002, 02:34 PM

Tags for this Thread