Rectangle Textures and RubyGameCommon

Sage
Posts: 1,482
Joined: 2002.09
Post: #1
Edit: solved the problem

This might be more of a Rectangle texture problem than RGC.
First of all, I added the rectangle texture constant myself, so it does exist and compiled fine.

So I have this code:
Code:
GL.Enable(GL::TEXTURE_RECTANGLE_EXT)    
GL.PixelStore(GL::UNPACK_ALIGNMENT, 1)
        
texNum = GL.GenTextures(1)[0]        
GL.BindTexture(GL::TEXTURE_RECTANGLE_EXT, texNum[0])
    
texPNG = load_png_image(fileName)
    
GL.TexParameter(GL::TEXTURE_RECTANGLE_EXT, GL::TEXTURE_WRAP_S, wrap)
GL.TexParameter(GL::TEXTURE_RECTANGLE_EXT, GL::TEXTURE_WRAP_T, wrap)
GL.TexParameter(GL::TEXTURE_RECTANGLE_EXT, GL::TEXTURE_MAG_FILTER, filter)
GL.TexParameter(GL::TEXTURE_RECTANGLE_EXT, GL::TEXTURE_MIN_FILTER, filter)
        
GL.TexImage2D(GL::TEXTURE_RECTANGLE_EXT, 0, GL::RGBA,
            texPNG['width'], texPNG['height'],
            0, GL::RGBA, GL::UNSIGNED_BYTE,
            texPNG['data'])

GL.Begin(GL::QUADS)
        GL.TexCoord(0, 0)
        GL.Vertex(xmin, ymin)
        GL.TexCoord(100, 0)
        GL.Vertex(xmax, ymin)
        GL.TexCoord(100, 100)
        GL.Vertex(xmax, ymax)
        GL.TexCoord(0, 100)
        GL.Vertex(xmin, ymax)
GL.End


I've taken out everything but the texturing code.

When drawn, all I get is a white squares, even with a solid color texture.
If I replace the TEXTURE_RECTANGLE_EXT with TEXTURE_2D, and change the texturing coordinates it works correctly.

On the other hand, I went to one of my programs in C and and tried to use GL_RECTANGLE_EXT and it told me it was undefined. Is there some special header needed? I also remember hearing that you need to load extensions explicitly, is this true?
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #2
GL_RECTANGLE_EXT should be in <OpenGL/glext.h>
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
*Smacks forehead again* Once again, after spending an hour looking for the problem, I find it shortly after posting.

I had simply missed a line in one of the files that set the texture target back to TEXTURE_2D.

Anyway, a new question. Is GL_TEXTURE_RECTANGLE_EXT supported cross platform? If it is, I should mention to Keith to add it.

Josh: Thanks, the Apple docs didn't mention any extra includes.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
NV_texture_rectangle, EXT_texture_rectangle, ARB_texture_rectangle, all the same thing. I can add the constant to the file if you want Smile
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
OneSadCookie Wrote:NV_texture_rectangle, EXT_texture_rectangle, ARB_texture_rectangle, all the same thing. I can add the constant to the file if you want Smile

I don't see why it shouldn't be made official.
Quote this message in a reply
Post Reply