Render-To-Texture?

Member
Posts: 148
Joined: 2003.03
Post: #1
I'm looking at the Render-To-Texture example located at http://www.pol-online.net/download.php?f...In_Texture and it doesn't appear to work on MacOS X.2.6 (or nVidia geForce cards). Can anybody point out why?
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #2
Seems to work fine for me.
450Mhz B&W G3/Rage128 16MB/X.2.6

What seems to be the problem on your mac?

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
I just get a white square on a black background on a GeForce4Ti.

I can't see anything wrong with the code, but it's clearly not working!
Quote this message in a reply
Member
Posts: 148
Joined: 2003.03
Post: #4
Yes I have a geForce as well, and all I see is a black background with a white square. It seems, from the code, the square is supposed to change color randomly. Hmm.
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #5
Try this:

change the pixelformat attributes to the following:
[sourcecode]NSOpenGLPixelFormatAttribute attributes[] = {
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAAccelerated,
0 };
NSOpenGLPixelFormatAttribute attributes2[] = {
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAAccelerated,
0 };[/sourcecode]

This may fix pixelformat incompatability problems.

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
Doesn't help (and it doesn't say invalid drawable in the console, which is what usually happens under those circumstances).
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #7
oh, the code is written wrong. I didn't look at it indepth because when I first ran it it made some color changing squares. Actually the pattern looks like invalid pointer access. Whoever wrote the demo is trying to make a texture from an offscreen context. This is fine and all, but 1)the texture is never updated and 2)he's trying to update it by changing it's context.

Code:
//this line is the dead give away:
    [mainContext createTexture:GL_TEXTURE_2D fromView:[offscreenWindow contentView] internalFormat:GL_RGBA];

from this point on, your results vary depending on what kind of memory GL is trying to read from. in my case GL was trying to get some of the actual context, so I saw some pretty garbage in the intervening space. (I thought this was intended but it is not.)

on your geforce's you're probably getting blank texture memory. I doubt this demo has any real value at all.

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #8
Lugaru has neat render-to-texture Smile

For some reason some systems don't like it though :/
Quote this message in a reply
Member
Posts: 148
Joined: 2003.03
Post: #9
What/who/where is Lugaru?
Quote this message in a reply
Member
Posts: 148
Joined: 2003.03
Post: #10
Ok so obviously the previous example isn't going to work for me. So I tried Lesson #36 on NeHe (Radial Blur) which appears to have render-to-texture functionality. However, it STILL doesn't work. All I see is a plain twirly model spinning around, no blur...again this is on a geForce. Any ideas?
Quote this message in a reply
Member
Posts: 148
Joined: 2003.03
Post: #11
I figured it out. Changing GL_LUMINANCE to GL_RGBA in the glTexImage2D function seems to fix it. It looks pretty cool. I guess I'll stick to this method. Thanks everyone.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #12
Quote:Originally posted by kelvin
Whoever wrote the demo is trying to make a texture from an offscreen context. This is fine and all, but 1)the texture is never updated and 2)he's trying to update it by changing it's context.

Code:
//this line is the dead give away:
    [mainContext createTexture:GL_TEXTURE_2D fromView:[offscreenWindow contentView] internalFormat:GL_RGBA];

I don't understand. What's wrong with this?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Render to Texture behaves weirdly ardowz 2 1,356 Feb 17, 2014 04:50 PM
Last Post: ardowz
  Render video (e.g. QuickTime) to buffer or texture? Ingemar 14 13,094 Jun 8, 2011 04:09 PM
Last Post: mdejong1024
  Render to Texture? IBethune 5 6,173 May 2, 2007 04:25 AM
Last Post: IBethune
  PBuffer & Render to Texture (read & write) habicht 4 4,097 Feb 7, 2005 05:33 PM
Last Post: habicht
  Render to texture and Blending reubert 3 4,162 Oct 30, 2004 04:48 AM
Last Post: arekkusu