Results 1 to 5 of 5

Thread: Best way to render a frame?

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    2

    Best way to render a frame?

    Can someone tell me the best way to draw a frame with OpenGL? At the moment I am using glDrawPixels with most of the features for 3D disabled to speed things up. However there must be a better way?

    I have investigated pixel buffer objects, but my graphics chip doesn't support this extension.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Best way to render a frame?

    What do you mean, a frame ?
    glDrawPixels is not always very fast.
    A textured quad or two textured triangles assembled in a quad is very fast.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    2

    Re: Best way to render a frame?

    By frame, I mean that I have an array of unsigned bytes in memory that I want to draw to the window. One thread writes to this memory as it knows what color each pixel is, and another thread will render the memory to the output window when it receives a WM_PAINT message using glDrawPixels.

    If I use a textured quad, do I need a special extension if my texture is not a power of two?

  4. #4
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: Best way to render a frame?

    I would use glTexSubImage2D to upload to a texture, and then a textured QUAD / TRIANGLE_STRIP (QUAD) to draw it on the screen.

    Without knowing what HW you are on I can't say whether you need a POT texture or not. Most HW these days will support NPOT textures, but in any case you can upload any shape you like to the texture using glTexSubImage2D (as long as it's a rectangular or square obviously!!) .

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Best way to render a frame?

    Then to draw it, adapt the texture coords to only show the relevant part, with something like : ((float)width)/texwidth instead of 1.0

Similar Threads

  1. OpenGL Render Frame Cap
    By TheGlitchGamer in forum OpenGL: User Software
    Replies: 6
    Last Post: 10-18-2017, 02:46 AM
  2. Re-create FBO (frame buffer object) each frame
    By Yossi Koren in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 06-15-2017, 03:25 PM
  3. Render frame with OpenGL in Qt
    By jgdddd in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-19-2015, 07:30 AM
  4. Render onto previous frame with blending
    By paradoxresolved in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-12-2014, 10:43 AM
  5. Frame Buffer and render to texture problem.
    By mickey123 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-27-2009, 11:35 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