text problem => ive a blackskware

cutibipoulet
Unregistered
 
Post: #1
i want dispay a image in java/opengl (jogl) to do a photoshop styled soft but i cant display any image.

this is how i wan draw my image :


gl.glDisable(GL.GL_COLOR);
gl.glEnable(GL.GL_TEXTURE_2D);
texture.bind(arg0.getGL());//blind of th texture
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2i(0, 0); gl.glVertex2d(x,y);
gl.glTexCoord2i(1, 0); gl.glVertex2d(x,finy);
gl.glTexCoord2i(1, 1); gl.glVertex2d(finx,finy);
gl.glTexCoord2i(0, 1); gl.glVertex2d(finx,y);
gl.glEnd();
gl.glDisable(GL.GL_TEXTURE);
gl.glEnable(GL.GL_COLOR);

but insteed of an image, i've a black skware


but my image to load is in 2^n pixel


and thisis how i put the text in the hardware
code sample :

gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, wrapMode);
gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, wrapMode);
gl.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, minFilter);
gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, magFilter);


and :


gl.glTexImage2D(target,
0,
dstPixelFormat,
realWidth,
realHeight,
0,
srcPixelFormat,
GL.GL_UNSIGNED_BYTE,
textureBuffer );

tanks for help
Quote this message in a reply
Member
Posts: 156
Joined: 2002.10
Post: #2
I'm not OpenGL expert (or JOGL expert!) but here's my 2p worth.

When using the C API to OpenGL I've never seen anyone use glDisable(CL_COLOR). When I want to draw a textured quad I do:

glEnable(GL_TEXTURE_2D);
glBindTexture(...);
glColor3f(1.0f, 1.0f, 1.0f); // This gives a white quad to draw texture onto
glBegin(GL_QUADS);
etc.

I think if you try that it should work.

I suspect disabling GL_COLOR is a bad thing.

Could be wrong though, YMMV!

- Iain
Quote this message in a reply
cutibipoulet
Unregistered
 
Post: #3
ok, i fired the glDisable(GL_COLOR) but allways my problem : a blackskware without textur
Quote this message in a reply
Member
Posts: 156
Joined: 2002.10
Post: #4
Quote:gl.glDisable(GL.GL_TEXTURE);


GL_TEXTURE refers to the texturing matrix. I'm not sure what this command would do, but what you want is GL_TEXTURE_2D.

This may fix it.

- Iain
Quote this message in a reply
cutibipoulet
Unregistered
 
Post: #5
noways ==> always the same problem....... f....
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
I bet that you've called glColor3f (0,0,0) somewhere to draw a black line or something, and then forgotten to set it back to white. Try calling gl.glColor3f (1,1,1) just before you draw the text.
Quote this message in a reply
cutibipoulet
Unregistered
 
Post: #7
ok i place gl.glColor3f (1,1,1) just before you draw the text, but i ave now a white skware...
in reality, i draw only the color but not the text............ I realy dont anderstand
Quote this message in a reply
Member
Posts: 116
Joined: 2005.02
Post: #8
First off, what kind of image do you want?
"gl.glDisable(GL.GL_TEXTURE);" This could be your problem...you're disabling all textures here and not just the 2D that you enabled earlier thus not doing what you want it to.
"texture.bind(arg0.getGL());" This may be your problem too. What kind of texture are you binding?

"gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, wrapMode);
gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, wrapMode);
gl.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, minFilter);
gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, magFilter);" Why isn't the text writing out?

Just some stuff to think about...I'm not entirely sure that I'm correct though...lastly, would this have anything to do with you putting GL. in front of everything?

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
execomrt
Unregistered
 
Post: #9
you missed glDisable(GL_LIGHTING);
Quote this message in a reply
cutibipoulet
Unregistered
 
Post: #10
glDisable(GL_LIGHTING); is default....

but to answer blox2, "gl.glDisable(GL.GL_TEXTURE);" is not my problem, cause i enable text before drawing it... but i also try everything gl.glDisable(GL.GL_TEXTURE_2D);.....


for the binding of the text, texture.bind(arg0.getGL()); <=>

if ((lastbind == null) || (lastbind != this)) {
gl.glBindTexture(target, textureID); /// target = GL_TEXTURE_2D ! like i want
}


i think, its good (im sur in reality...)



for :
gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, wrapMode);
gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, wrapMode);
gl.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, minFilter);
gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, magFilter);


this text is writing out since its write when i load the text ( juste one call ) but all my text loader is good, cause i took a text loader on the sunwebsite... (and i look for the code, its good !)


tanks for help but its dont work.......
Quote this message in a reply
cutibipoulet
Unregistered
 
Post: #11
Just a simple questin, how to know if my text, is correctly in the hard....? ( without texturing ) cause its may be my problem....
Quote this message in a reply
Member
Posts: 116
Joined: 2005.02
Post: #12
Is there a chance that it is either not ignoring this or picking up an extra '/' in the code?

/// target = GL_TEXTURE_2D

or is it the fact that even though you're binding text to it that you didn't tell it what text to bind?

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
w_reade
Unregistered
 
Post: #13
Maybe logging the result of a "gl.glIsTexture(TextureID)" in your bind() function would help a bit -- then you'd at least know whether you'd loaded the texture right. If the texture does exist, it might be worth looking at the actual data in textureBuffer, and checking that you're loading what you expect to.

Actually, I know what you should do: run it under OpenGL Profiler (in "/Developer/Applications/Graphics Tools"). Open the "Breakpoints" window, and tick all 3 "Break on [something]" checkboxes, and then start the app. If anything goes wrong, you'll see what and where; you can also check the "Collect Resources" box (in the first window that opens after you've chosen the app to run), and then you can see what your texture actually looks like. Can't give proper tutorial, I'm afraid, but IIRC there are some docs somewhere.
Quote this message in a reply
cutibipoulet
Unregistered
 
Post: #14
tank's w_reade !
ok, ive a problem

int[] tmp = new int[1];
gl.glGenTextures(0, tmp);

===================================

gl.glIsTexture(tmp[0]) <=== FALSE !

but i dont know how tu resolve that if somebody can helpme.
Quote this message in a reply
Puzzler183
Unregistered
 
Post: #15
cutibipoulet Wrote:tank's w_reade !
ok, ive a problem

int[] tmp = new int[1];
gl.glGenTextures(0, tmp);

===================================

gl.glIsTexture(tmp[0]) <=== FALSE !

but i dont know how tu resolve that if somebody can helpme.


Uh, you told it to generate 0 texture objects so how many did you expect to get?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Text rendering problem with VBOs on myfeng 9 6,000 Feb 29, 2008 04:54 PM
Last Post: OneSadCookie