Results 1 to 2 of 2

Thread: simple 2D scene

  1. #1
    Newbie Newbie
    Join Date
    Oct 2016
    Posts
    1

    Question simple 2D scene

    Hi! I am new to OpenGl. So far, I have been able to draw polygons on my screen and I have been able to apply textures, use matrix transformations, scaling, texture wrapping etc. I have only worked in 2D.

    Now, I want to make a simple animated 2D scene using textured polygons. How do I do this? More specifically, how do I go about defining and using more than one element? Do I definue an array for vertex co-ordinates for every element or just put all the co-ordinates in one array ( sounds like a bad idead) ? I want to do this in an optimized way for which, according to my understanding so far, I should limit the glDraw() calls.

    On another note, when using textures, does the glDisableVertexAttribArray() need to be called on the texture co-ordinates too? If yes, then why? Thank you.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2013
    Posts
    186
    I would suggest putting all static images (like backgrounds, etc) in one VBO and all dynamic images (animated sprites, moving objects, etc) in a second VBO. If you have any translucency you should sort the sprites back to front. If they are all completely opaque you dont need to sort. You can use the Z-coordinate and the depth buffer instead. Rendering 2D is pretty fast usually and doesnt need too much optimization unless you actually notice any performance problems.

Similar Threads

  1. Simple Cube not Showing up with simple Example ...
    By tmason in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-26-2014, 11:42 PM
  2. [android] Weird perfomance for simple scene
    By eduardo-costa in forum OpenGL ES
    Replies: 0
    Last Post: 09-02-2014, 11:26 AM
  3. Strange alpha Problem in simple scene
    By uwi2k2 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-16-2014, 07:02 PM
  4. Simple Scene Picking
    By David Doria in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-09-2008, 08:12 AM
  5. how to display 2d scene on top of 3d scene???
    By immy in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 03-26-2002, 04:13 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