Results 1 to 3 of 3

Thread: Rectangles appear as triangles

  1. #1
    Guest

    Rectangles appear as triangles

    I am running a bsp loader that I found on the internet. It loads and renders (using opengl) version 46 bsp files (quake 3). When I run the application with the bsp file that comes with this sample program it displays four interconnected rooms with textures and lighting.

    When I try to create my own simple room (four walls, ceiling, and floor) using gtkradiant and then load this bsp. I am able to load and render the bsp file but all six faces simply show up as triangles (properly textured) not the rectangles that they should show up as.

    Any idea what I may be doing wrong (presumably in the bsp compilation phase) that would cause these polygons to show up as triangles?

    When I look at the code I see that the faces (polygons) are all being rendered using the GL_TRIANGLE_FAN:

    glDrawArrays(GL_TRIANGLE_FAN, polygonFacespolygonFaceNumber].firstVertexIndex,
    polygonFaces [polygonFaceNumber].numVertices);

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2005
    Location
    France
    Posts
    10

    Re: Rectangles appear as triangles

    Try with GL_QUADS maybe?

    If it doesn't work, look at if the texture is a rectangle (posx.jpg or other).

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,662

    Re: Rectangles appear as triangles

    You got the solution on your own ! So, whether you try to find how to model your scene with fan triangles or whether you change the code so that it can recognized other primitives. The last might be a bit hard, but the former might not be possible.

    Hope that helps.

Similar Threads

  1. need help in drawing rectangles nd triangles
    By Need_Help in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 04-20-2011, 09:10 AM
  2. Overlapping Rectangles
    By gh001 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-01-2008, 10:55 AM
  3. Drawing rectangles
    By gator in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-08-2003, 08:27 PM
  4. 3d rectangles
    By aap9 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-22-2001, 12:49 AM
  5. glScissor - rectangles
    By holy_moly in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-27-2000, 10:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean