OpenGL Textures

James
Unregistered
 
Post: #1
OK, I am moving my code from QuickDraw to OpenGL and making steady progress. I have a few textures that are 640 x 480 which was fine under QD, Is it correct that now I need to split these up to 256 x 256 blocks and use multiple QUADS to redraw the texture?
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #2
that would be the best way, yes
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
It's probably the best way, but it's not the only way.

All cards can handle 512x512 textures just fine, so you could use fewer pieces with more waste.

All cards better than the Rage 128 handle EXT_texture_rectangle, so you could use a 640x480 texture if you don't care about Rage 128 support, REPEAT or mipmaps.

All cards better than the Rage 128 (and even the Rage 128 in theory, though the practice is shakier) handle 1024x512 just fine, so you could use one of those.
Quote this message in a reply
James
Unregistered
 
Post: #4
I didnt know 1024 was supported. I tried a 1024x1024 texture and my powerbook crashed (never chased the real cause of the crash).

What do you mean by shakier? Is 1024 x 512 really support or should I just stay away from it?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
Slightly OT, do rectangle textures allocate just the amount of memory needed, or do they place it in a texture of the next possible size? (i.e. 640x480 -> 1024x512)
Quote this message in a reply
James
Unregistered
 
Post: #6
I found on my hardware that unless I specified the texture to be 128/256/512 x 128/256/512 it didn't draw it (Ex I said the texture is 640x480).

I assumed that is normal. Is this not the case?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
for TEXTURE_2D textures, you're correct. TEXTURE_RECTANGLE_EXT textures don't have that restriction, though they do have others. Skorche: they don't use more VRAM.

WRT 1024x512 support, it's just running dangerously close to the limits of VRAM on an 8M Rage 128. the chip itself supports 1024x1024 textures just fine, and on 16M Rage 128s, you should be able to use them without problems.
Quote this message in a reply
James
Unregistered
 
Post: #8
OK, I have the code working great. Thanks for the help.

However, I am trying to play a short movie. Each frame I load a 640x480x32 image into a gworld then turn it into a OpenGL texture. I then draw the texture and delete it then move onto the next frame. If I do 1 large 1024x1024 image i only get 15FPS on a PB G4 1Ghz, but if i cut the image into 128x128 textures my frame rate jumps drastically. Is this right or is something weird going on?
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #9
isn't there a way to render an NSMovie to an NSView?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
for playing QuickTime movies into OpenGL textures:

http://onesadcookie.is-a-geek.net/svn/repos/QTValuePak/

(or try the Apple sample code, it's more complex but probably more efficient)
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #11
Movie->texture is very tricky because you have to worry about DMA and the texture format.
See TextureRange for fast texture upload, and OpenGLCompositorLab for playing QT onto a textured surface.

Tiger will make this much easier...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [SOLVED]OpenGL edges of textures mk12 2 4,394 Sep 2, 2010 08:07 PM
Last Post: mk12
  OpenGL Image Textures mikey 52 24,553 Jun 30, 2009 10:42 AM
Last Post: AnotherJake
  Dealing with inverted textures in OpenGL johncmurphy 7 7,023 Jun 15, 2009 08:11 AM
Last Post: Skorche
  Using textures OpenGL switches to software renderer bruno 2 3,561 Oct 12, 2008 03:06 AM
Last Post: bruno
  Loading and using textures with alpha in OpenGL with Cocoa corporatenewt 4 6,202 Dec 8, 2007 02:06 PM
Last Post: Malarkey