Results 1 to 10 of 10

Thread: 2D displays

  1. #1
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    2D displays

    I have seen this before, but will just check.
    The quickest way to display a bmp is as a texture on a poly, as opposed to drawpixels etc.
    Then obviously use translate, scale, and rotate to position it in the window.
    Whats the quickest way to clip the edges, I can think of a few but I don't think they will be particularly quick.

    thanks

    gav

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: 2D displays

    Either add additional clippingplanes, or simply modify the polygons vertex-/texture coordinates to simulate clipping.

  3. #3
    Member Contributor
    Join Date
    May 2001
    Location
    Cheltenham,Gloucestershire,England
    Posts
    59

    Re: 2D displays

    Hello there,

    use GL_SCISSOR_TEST and specify the rectangle
    in window coordinates you wish to use.

    This function also limits glClear etc to this rect.

    Hope this helps.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: 2D displays

    Ok.....
    my images are not byte^x squared dimensions so I have padded them, and altered the poly/tex binding appropriately. This seems ok but as images get larger then the more padding is needed, at what sort of stage would it be better to revert to drawpixels, or never?

    gav

  5. #5
    Member Contributor
    Join Date
    Apr 2000
    Location
    Salt Lake City, UT
    Posts
    52

    Re: 2D displays

    Out of curiosity, how can one align and scale a textured quad to fit the screen "exactly?" Is there some math involved? Also, what is a reasonable texture size that I can use for a fullscreen 2d image? I assume that I couldn't just use a 1024x1024 pixel image, could I? Or would I have to break it up?

    Thanks,
    Greg

    [This message has been edited by gtada (edited 06-01-2001).]

  6. #6
    Member Contributor
    Join Date
    Feb 2000
    Location
    Brisbane,QLD, Australia
    Posts
    99

    Re: 2D displays

    You can use any size texture that you like as long as the target GL implementation supports textures to that size. As implementations differ you had best use glGet with GL_MAX_TEXTURE_SIZE to return the max dimensions of textures supported on your implementation, friends/customers machine. GeForce or better NVidia cards support 2048x2048 and also support textures of non-equal dimensions via the extension NV_texture_rectangle.

  7. #7
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: 2D displays

    I assume that non equal dim textures are not supported on too many cards? And you have to specify, via the card, thatr it isn't. It would make senes for opengl to query the card when you specify the dims of the texture....

  8. #8
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: 2D displays

    gtada - check the faq link first page right side. IIRC section 9

  9. #9
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: 2D displays

    So I load my jpg files and tex map them, clip em etc...
    Now I want to draw on them using the mouse. Best way to do this, sorry quickest way? The obvious way is to have a big array of x/y points and then loop through this array and draw the points/lines. Would it be beter to set up a buffer and then do logic ops with the back buffer.

    gav

  10. #10
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: 2D displays

    Just wanted to clear up what sounds like a misconception in some of the responses in this thread. Textures do not have to be square. As long as both width and height are a power of two, and neither of them is bigger than the GL_MAX_TEXTURE_SIZE. The extension NV_texture_rectangle can be used to create textures that aren't a power of 2. You don't need it if you were going to create a texture that was, say 1024x256.
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Multiple Displays
    By enist in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-16-2003, 01:06 AM
  2. WUXGA Displays (16:10) ...
    By Andrew Jameson in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 06-23-2003, 11:31 AM
  3. my program displays nothing, can you help me ?
    By airseb in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-29-2003, 10:20 AM
  4. why my program displays nothing ?
    By airseb in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-08-2003, 01:12 PM
  5. switching between displays
    By prashantgp in forum OpenGL: Basic Coding
    Replies: 19
    Last Post: 02-13-2003, 07:01 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