Results 1 to 2 of 2

Thread: General OpenGL questions

  1. #1

    General OpenGL questions

    1. Is it OK to use textureimage which have different height than width.
    Or does texture dimensions allways have to be width=height?

    2. Is there any speed differenses if I draw four rectangles with GL_TRIANGLES or GL_TRIANGLE_STRIP??

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: General OpenGL questions

    1. Is it OK to use textureimage which have different height than width.
    Or does texture dimensions allways have to be width=height?
    Yes, you can, providing both width and height are a power of 2 i.e.:

    128x64, 512x32, 256x256 are acceptable.
    On the other hand, you can not use 333x222 directly (although it works with gluBuildMipmaps).

    2. Is there any speed differenses if I draw four rectangles with GL_TRIANGLES or GL_TRIANGLE_STRIP?? ?
    If you draw 4 rectangles with GL_TRIANGLES, you need 8 triangles i.e. 24 vertices.
    If you draw the same 4 rectangles with GL_TRIANGLE_STRIP, you need only 4 vertices per rectangle i.e. 16 vertices (that is, if your rectangles do not share edges between them).

    As you can see, it is a much better idea to use GL_TRIANGLE_STRIP: you optimize your bandwidth (instead of passing a lot of boring vertices to your gfx card, you could pass it a lot more interesting things !).

    I know some drivers will detect that you are indeed passing a strip but I really believe you had better doing it in your own code...

    Hope this will help you !

    Regards.

    Eric

Similar Threads

  1. General questions
    By khodas in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-16-2010, 02:09 PM
  2. two general glsl questions
    By Vexator in forum OpenGL: GLSL
    Replies: 4
    Last Post: 08-13-2006, 09:37 AM
  3. General Questions about Translations
    By Frizzle_Fry in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-24-2004, 09:53 AM
  4. General questions..
    By Ace_Man in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-04-2000, 01:01 AM

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