GL_EXT_texture_rectangle

Hi Folks,

Has anyone an example on how to use the GL_EXT_texture_rectangle extension
to set up a 2D texture? Currently I'm doing something like this:

void
guiGLCanvas::initializeTexture(GLuint &texture)
{
   glGenTextures(1, &texture);
   glBindTexture(GL_TEXTURE_2D, texture);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_TexWidth, m_TexHeight,
                0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}

where the texture height/widths are big enough to cover the canvas,
however using GL_EXT_texture_rectangle would be better as the canvas
is not square of a power of 2.

thanks,

Keith
0
false (23)
11/19/2006 4:35:07 PM
comp.graphics.api.opengl 7071 articles. 1 followers. Post Follow

5 Replies
579 Views

Similar Articles

[PageSpeed] 20

Keith S. wrote:
> Hi Folks,
> 
> Has anyone an example on how to use the GL_EXT_texture_rectangle extension
> to set up a 2D texture?

I think you just need to replace "GL_TEXTURE_2D"
with "GL_TEXTURE_RECTANGLE_ARB"


> void
> guiGLCanvas::initializeTexture(GLuint &texture)
> {
>   glGenTextures(1, &texture);
>   glBindTexture(GL_TEXTURE_2D, texture);
>   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
>   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
>   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_TexWidth, m_TexHeight,
>                0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
> }
> 

Rectangle textures can't do mipmapping so you
need to set filtering modes.


-- 
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

0
fungus
11/19/2006 4:56:10 PM
fungus wrote:
> Keith S. wrote:
>> Hi Folks,
>>
>> Has anyone an example on how to use the GL_EXT_texture_rectangle 
>> extension
>> to set up a 2D texture?
> 
> I think you just need to replace "GL_TEXTURE_2D"
> with "GL_TEXTURE_RECTANGLE_ARB"

thanks Fungus, however if I try that I get an error that GL_TEXTURE_RECTANGLE_ARB
is undefined... this in on win32 using VC++ 7.1

- Keith
0
Keith
11/19/2006 6:43:34 PM
Keith S. wrote:

> thanks Fungus, however if I try that I get an error that 
> GL_TEXTURE_RECTANGLE_ARB
> is undefined... this in on win32 using VC++ 7.1

ok I defined it manually... the other needed change was
to set texture coords to be in the range 0-w, 0-h rather
than 0-1, 0-1.

- Keith
0
Keith
11/19/2006 8:12:48 PM
Keith S. wrote:

> Keith S. wrote:
> 
>> thanks Fungus, however if I try that I get an error that
>> GL_TEXTURE_RECTANGLE_ARB
>> is undefined... this in on win32 using VC++ 7.1

You need to #include <glext.h>

> ok I defined it manually... the other needed change was
> to set texture coords to be in the range 0-w, 0-h rather
> than 0-1, 0-1.

Yes. Within glsl shaders, this is required, too.

0
Rolf
11/19/2006 8:46:13 PM
Keith S. wrote:
> 
> thanks Fungus, however if I try that I get an error that 
> GL_TEXTURE_RECTANGLE_ARB
> is undefined... this in on win32 using VC++ 7.1
> 

Get glext.h from here:

http://www.opengl.org/registry/


-- 
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

0
fungus
11/19/2006 9:02:53 PM
Reply:

Similar Artilces:

OpenGL hardware acceleration for the LabVIEW's OpenGL graphics engine?
In another thread about running recent versions of LabVIEW on older hardwar= e, someone mentioned that LabVIEW uses OpenGL for its graphics engine [whic= h would make sense, because there's no such thing as DirectX for Linux or S= parc/Solaris or whatever]. This got me to thinking about the question of af= fordable graphics cards with good OpenGL acceleration that meshes well with= LabVIEW.<br><br>Unfortunately, when I went to Google on OpenGL hardware re= views, the hits that I got were rather old [by video card standards]:<br><b= lockquote><br><b>Open...

Console graphics APIs
Does anyone know what graphics APIs are used for console programming (GameCube, PlayStation2, Xbox)? All three systems probably support OpenGL, and I can see the Xbox using DirectX. I'm asking because I plan on becoming a console games programmer and I'd like to know which I should learn first. //mike tyndall In article <1JudnbSKfsK4eI_cRVn-hA@comcast.com>, Mike Tyndall <swtyndall@hotmail.com> wrote: >Does anyone know what graphics APIs are used for console programming >(GameCube, PlayStation2, Xbox)? All three systems probably support OpenGL, >and...

OpenGL API question
Most of the games, written for Windows, that aren't portable, use Direct X. Now and then, however, there's a game that uses Open GL and is _not_ portable... I am mystified why. Any ideas? keith wrote: > Most of the games, written for Windows, that aren't portable, use Direct > X. Now and then, however, there's a game that uses Open GL and is _not_ > portable... I am mystified why. Any ideas? Graphics is not the only part of a game. There are Sound, User Input and a lot of other potentially unportable stuff involved. However most game engines are very portable, and h...

JAVA graphic API
Hello, I'm searching a java free graphic API to draw chart / Bars / Lines for 2 series on a double (lef and right axis) ? ANy suggestion ? On Tue, 23 Nov 2004 19:49:58 +0100, <Jean Gillet> wrote: > I'm searching a java free .. I take it you mean '(written in) Java (and) free', rather than 'without Java/lacking Java'. [ ;-) ] >..graphic.. Best group for things 'graphic'.. <http://www.physci.org/codes/javafaq.jsp#cljg> >..API to draw chart / Bars / Lines <http://www.cs.uu.nl/wais/html/na-dir/computer-lang/java/gui/faq.html>...

OpenGL ES API
Can anybody please let me give some example code for 1) glReadPixel 2) glCompressTexSubImage2D 3) glQueryMatrixOES Any web site/link for the same would be also appreciated. Thanks in advance Ajay ajay.k@in.bosch.com ...

OpenGL api call ?
Hi all I am making some examples with openGL and I have one problem with two functions. "glGenTextures y glDeleteTextures." OpenGLLibrary>>glGenTextures: n textures: textures " Generate texture names void glGenTextures( GLsizei n, GLuint * textures); n: Specifies the number of texture names to be generated. textures: Specifies an array in which the generated texture names are stored." <stdcall: void glGenTextures sdword dword*> ^self invalidCall OpenGLLibrary>>glDeleteTex...

openGL for turtle graphics
I am developing a Logo-like turtle graphics system in the programming language J http://www.jsoftware.com/ . At present the system is implemented in a graphics system called "gl2". J is adopting "openGL" and I am assuming it is a much richer graphics environment. openGL likely includes sprites or layers or some other feature that would make managing turtles separately from the background much easier. There may also be openGL features for screen wraparound and slide controls for window scrolling. Are there any existing openGL implementations of such systems that I could ...

OpenGL For Non-Graphics Processing
I don't know if it's of interest to anyone in here, but I thought it may be worth mentioning a product that uses shaders to harness the processing power on modern GPU's, as it might turn a few wheels in your own minds. "BionicFX announced a technology for music production that turns NVIDIA video cards into audio effects processors. Audio Video Exchange (AVEX) converts digital audio into graphics data, and then performs effect calculations using the 3D architecture of the GPU. The latest video cards from NVIDIA are capable of more than 40 gigaflops of processing power c...

2D vector graphics with OpenGL
With OpenGL and the Common Lisp Application Builder project it is easy to create nice 3D animations: http://svn.sourceforge.net/viewcvs.cgi/*checkout*/lispbuilder/trunk/lispbuilder-opengl/documentation/index.html (the lispbuilder-opengl-package will be released later at Sourceforge) But OpenGL is useful for fast 2D vector graphics, too, because drawing operations are accelerated by the graphics card. I've implemented a very basic SVG path parser (in 16 lines with lispbuilder-lexer) and used the SVG file from http://www.lisperati.com/logo.html for rendering something with OpenGL: http://...

the graphics and the concept of the graphic
Hiya all. everybody should applicate this type of guidelines This movement builds a strong visual link between the head and shoulders. If you get the correct relationship between the eyes, nose and mouth, you will end up with a good likeness. Our Pencil Portrait lesson explains and illustrates the step by step drawing techniques involved in creating the portrait of a young girl. At this stage, the drawing is no more than a set of carefully measured features that establish the final proportions of the portrait. There are three basic stages in the creation of the image...

API to change the DPI of a graphic
I would like to use the FrameMaker 7.1 API to programmatically set the DPI of an image (a PNG imported by reference in this case) to a set value (eg 125). I was hoping I could use the property FP_InsetDpi against the SetPropVAL function, but that doesn't work. Any ideas? Anyone have some sample code? Thanks. David. ...

[VW] Jun OpenGL API
Hi, could someone tell me where I can locate the Smalltalk Jun OpenGL API? Thanks in advance, -Conrad Try http://www.sra.co.jp/people/aoki/Jun/Main_e.htm Koh http://www.askoh.com conradwt@runbox.com (Conrad) wrote in message news:<ee6b22c3.0405301401.3f5b14c5@posting.google.com>... > Hi, could someone tell me where I can locate the Smalltalk Jun OpenGL API? > > Thanks in advance, > > -Conrad Hi, is there "Textbook about Jun for Smalltalk" in English? I guess I'm looking for a usage + API. Thanks in advance, -Conrad askoh@...

Graphics--combining graphics
I am trying to create an animation of a piecewise function. I have a graph of a ball rolling and I would like to combine an animation for one equation of motion for the first part with another equation for the second part of the motion. It is easy enough to create the two animations individually, however I am stumped on how to combine them into one continuous animation. Link to the forum page for this post: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=10007#p10007 Posted through http://www.mathematica-users.org [[postId=10007]] ...

graphic inside a graphic
Hi everyone Does anybody know how to insert a graphic inside a graphic?? I mean, to add a small graphic (as a zoom for example) inside a plot. Thanks augusto try axes try axes check out the tool 'imshow()', then try to bring the figure in shape get(gca) and superimpose your graph - 'hold on', 'plot()', 'hold off' (Haven't tried it my self so far) Thorben The example below shows you how to insert a graphic (e.g. photo) into another MATLAB figure. I = imread('peppers.png'); theta = linspace(-pi,pi,200); figure; plot(theta,cos(theta)); gr...

paintComponent(Graphics graphics)
Hi=20 I hope I can explain this clearly without getting into too much detail as t= he code in question is a couple of thousand of lines. So to begin, I have = a JPanel to which I add JLabels and JComponents using JPanel's add() method= .. It works fine, but now I would like to print an image ON TOP of the adde= d JLabels and JComponents. For this I manipulate my JPanel's paintComponen= t(Graphics graphics) method. In it I have something of the following sort: paintComponent(Graphics graphics){ Graphics2D g =3D (Graphics2D)graphics.create(); g.drawImage(image, 200, ...

Web resources about - GL_EXT_texture_rectangle - comp.graphics.api.opengl

Resources last updated: 1/24/2016 3:43:47 AM