Results 1 to 2 of 2

Thread: lots of questions !

  1. #1
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Årsunda,gästrikland,Sweden
    Posts
    113

    lots of questions !

    I want to make a class for storing of my objects. so far I have made a little class that has a vertex array and a triangle index.

    the rendering function is built in in this class so I only make a call like this:
    Cube.Render();

    the render function is rendering with singel triangles (GL_TRIANGLES), before the loop I rotate, move and set the material. this information is stored in my object class.

    but in the OpenGL book I have (superbibel 2nd ed.) they set the material when they setup the lights, and then they use glColor to set the color of the object.

    is there any difference when I set material like this ? why do they set the material when they set the lights ? isn´t the material for the object ?

    and then I wan´t to know if there is any difference in speed using single triangles then triangle strips or quads ?

    what do I need to have in my object class to draw the object I like ?

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: lots of questions !

    >>but in the OpenGL book I have (superbibel 2nd ed.) they set the material when they setup the lights, and then they use glColor to set the color of the object.<<

    This needs COLOR_MATERIAL to be enabled.

    >>is there any difference when I set material like this ?<<

    Frequent material changes (e.g. per vertex) is faster via color material instead of independent glMaterial calls.

    >>why do they set the material when they set the lights ?<<

    The lighting in OpenGL works on materials not on colors.

    >>isn´t the material for the object ?<<

    Well, not really, glMaterial is one of the few calls you can do in between glBegin-glEnd.

    >>and then I wan´t to know if there is any difference in speed using single triangles then triangle strips or quads ?<<

    There is a huge difference in geometry performance if the strips contain more than one triangle
    Example: 102 (or n) vertices result 100 triangles (or n-2) in a single strip, but only in 34 independent triangles. That means the geometry requirements for independent triangles are three times higher for large numbers of vertices.

Similar Threads

  1. Replies: 2
    Last Post: 10-19-2017, 08:06 AM
  2. Lots of small shaders or one big one?
    By Don't Disturb in forum OpenGL: Advanced Coding
    Replies: 19
    Last Post: 09-28-2007, 11:41 AM
  3. Trying to use MesaGL... Need lots of help.
    By in forum OpenGL: Linux
    Replies: 1
    Last Post: 09-11-2003, 01:53 AM
  4. Lots of RCs
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-31-2003, 06:11 PM
  5. lots of questions.....
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-22-2001, 08:45 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