Is the profiler lying/can GL use previous binds/will...

Jones
Unregistered
 
Post: #31
akb825 Wrote:What's wrong with mipmapping? I though TomorrowPusX was able to get it working.

Me too, actually. He didn't use gluBuild3DMipmaps though, I bet. (I'm a wee bit lazy. Wink )

I fixed my problem with the lines. This is actually a useful bit of info for you guys (incase you didn't already know).

Code:
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);

Is the solution. Smile
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #32
You probably could build your own, scaling down the width and height and not depth. I will probably try that whenever I get the chance, since I really don't want to handle interpolating between 6-8 textures. Wacko (all I have to do, though, is find an algorithm to downscale an image... Sneaky)

Edit: never mind, you can't do that. You must reduce the r as well. So, TomorrowPlusX, how did you do it? Meanwhile, I'll look up solutions to get massive multitexture interpolation implemented...

Editx2: messing around with the LOD bias might prove useful, too
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #33
Jones Wrote:And it would seem that multitexturing is an extension, whereas 3D textures have been in the core since 1.3 (or was it .4? Wacko ).

Whether it's an extension or not is completely irrelevant. What matters is hardware support. Multitexturing is supported by everything Mac OS X supports; 3D textures are not.

In any case, everything we've discussed was once an extension --
ARB_multitexture and ARB_texture_env_combine, promoted to core in 1.3
EXT_texture_3D, promoted to core in 1.2
ARB_shading_language_100 & friends, promoted to core in 2.0
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #34
akb825 Wrote:You probably could build your own, scaling down the width and height and not depth.

No, you can't. All dimensions are halved at each mipmap level, no matter what you want. That is what the spec says. Go read the other thread.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #35
Read my edit, I corrected myself.
Quote this message in a reply
Jones
Unregistered
 
Post: #36
Yes, I remember TommorowPlusX's thread on the subject.

Well my code works sorta. With 3 textures it throws a 1280 and a 1281 (gl errors) which are the equivalents of GL_INVALID_ENUM and GL_INVALID_VALUE, respectively.

I'm trying to track them down but it's tough, when I call glGetError at various places sometimes I get 0's where they weren't before. Does calling glGetError automatically clear the error value?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #37
Yes, GetError pops one error bit. There can be multiple bits set simultaneously though.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #38
I suggest declaring a static (or global) variable so that you only cal glGetError once in your drawing function. (aka: only cal glGetError if it's TRUE, and have it originally FALSE and set it to TRUE when you call glGetError) Then, move the call around until you get the exact place (or places) where the error occurs.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #39
... or you could just use the OpenGL profiler's "break on error" to go to exactly the call that generated the error, rather than using a tedious, time-consuming and error-prone process like that...
Quote this message in a reply
Jones
Unregistered
 
Post: #40
Well, I tracked that error down, but now I've got more.

It seems that whenever I enable GL_TEXTURE_3D, standard 2D textures stop working. I can't bind them, load data into them or draw them.

Hmm, unpleasant surprise. I'm gonna have to write some methods in that dynamically switch between 2D and 3D so I can use both.

Annoying. Annoyed

EDIT: I've just had a thought. That's not possible, I think. Because I was just loading 2D textures and then making 3D textures... or was I? *runs off to test*
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #41
Were you sure to call glDisable(GL_TEXTURE_3D) after being finished with 3D textures, and call glDisable(GL_TEXTURE_2D) after being finished with 2D textures? (aka: do you ever have more than one enabled at once?) You should only have 1 texture type enabled for each texture unit enabled at 1 time.

OSC: Thanks for the info on OpenGL profiler, I didn't know that. (of course, almost all of my debugging is done through print statements coupled with stack backtraces... Sneaky)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #42
For textures, there is a precedence order for which one "wins" if you have multiple kinds glEnable'd at the same time. TEXTURE_3D is quite high on that hierarchy.

You shouldn't ever care though -- only enable one texture target at once!

[edit]Beaten by akb825![/edit]
Quote this message in a reply
Jones
Unregistered
 
Post: #43
It sort of works now, but for some reason adding more textures screws up the GL_TEXTURE_2D/3D thing. I guess I'll just keep changing targets. So it might look like this:

Code:
glEnable(GL_TEXTURE_2D);
// load 2d tex
glDisable(GL_TEXTURE_2D);

glEnable(GL_TEXTURE_3D);
// load 3d tex
glDisable(GL_TEXTURE_3D);

glEnable(GL_TEXTURE_2D);
// draw 2d tex...

//etc...
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #44
You don't need to call glEnable with a texture type when you're loading, only drawing.
Quote this message in a reply
Jones
Unregistered
 
Post: #45
akb825 Wrote:You don't need to call glEnable with a texture type when you're loading, only drawing.

Ah, even better. Thanks for the tip.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL profiler 3.2 - 0.0 Frame Rate? kelvin 0 2,502 Mar 3, 2006 01:21 AM
Last Post: kelvin
  OpenGL Profiler Nick 15 6,590 Mar 29, 2005 06:56 PM
Last Post: Nick
  OpenGL Profiler, or, "where did all my files go?" sealfin 2 2,740 Sep 3, 2004 12:19 AM
Last Post: sealfin
  OpenGL profiler & display lists MattDiamond 9 4,260 Sep 1, 2003 08:07 PM
Last Post: MattDiamond
  OpenGL profiler LongJumper 11 4,376 Apr 4, 2003 08:18 PM
Last Post: Fenris