|
Fecotourist posted:2. Does it matter whether Fecotourist posted:3. How much does spatial locality matter to performance on modern hardware? Why are you worrying about locality when you're operating on sets of 8 verts? Also: why do you always hit "enter" after a few words? It's really annoying. Also also: why do people (in general, not just you) always ask for help before they've even started on a project? You'll learn much better if you work on things yourself and maybe consult a book.
|
# ? Jan 18, 2009 04:51 |
|
|
# ? May 16, 2024 18:51 |
|
Avenging Dentist posted:Both ways are pretty common, and it probably doesn't matter especially unless you already know it matters. Avenging Dentist posted:Why are you worrying about locality when you're operating on sets of 8 verts? Let me rephrase the question. Given a big vertex array and two possible index arrays, A and B: code:
Avenging Dentist posted:Also: why do you always hit "enter" after a few words? It's really annoying. Is it more annoying than a single-line post that is stretched to 50 line equivalents by a big dumb avatar? Avenging Dentist posted:Also also: why do people (in general, not just you) always ask for help before they've even started on a project? You'll learn much better if you work on things yourself and maybe consult a book. I don't think that's the case here. My application already runs ok using OpenSceneGraph, [which seems to be using the glDrawElements() path the way I've been doing it]. For various reasons, I'm switching from OSG to SDL plus explicit OpenGL. If I'm doing that work, I just want to follow a good path.
|
# ? Jan 18, 2009 05:45 |
|
Fecotourist posted:Let me rephrase the question. Given a big vertex array and two possible index arrays, A and B: It'll probably be a little bit faster, but seriously, it sounds like you're trying to work on micro-optimizations before you even have a working (re)implementation. If it takes zero extra work to maintain locality, do it, but you're seriously overthinking things. Fecotourist posted:Is it more annoying than a single-line post that is stretched to 50 line equivalents by a big dumb avatar? Far more. If I want shorter columns I'll resize my browser window. Fecotourist posted:I don't think that's the case here. My application already runs ok using OpenSceneGraph, [which seems to be using the glDrawElements() path the way I've been doing it]. For various reasons, I'm switching from OSG to SDL plus explicit OpenGL. If I'm doing that work, I just want to follow a good path. Have you run performance tests to determine where your bottlenecks are? Those would give you way more information than some random internet people who don't know the specifics of your code.
|
# ? Jan 18, 2009 06:42 |
|
Avenging Dentist posted:
My meshes are LOD'ed, and the global detail level is adjusted continuously to maintain a target frame rate, so I can assert pretty confidently that rendering will often be a bottleneck. More detail than that, I don't know. With per-vertex normals and a single texture (cheap per pixel, right?), I have the impression that it's worth a little effort up front to make the geometry expression efficient. But my take home seems to be that glDrawElements() is not a totally stupid way to go, that packed/separate doesn't matter a priori, and that it's probably not a huge deal that my index arrays jump around in memory, so thanks for that confirmation.
|
# ? Jan 18, 2009 20:25 |
|
I'd say store it as a VBO on the gpu and only call it by id. Also 8 vertexes easily fit into the GPU transformation cache so nothing to worry about there. If you have meshes of several hundreds of thousands of vertices you want to make sure your geometry is reusing indexes as efficiently as possible.
|
# ? Jan 18, 2009 20:35 |
|
You can also take advantage of D3DX's ID3DXMesh::OptimizeInPlace function, which will handle index optimization. It doesn't depend on using D3D for rendering, and you can do it either during load or in the content pipeline (the latter being preferred).
|
# ? Jan 19, 2009 00:57 |
|
the glVertexAttrib family of functions allows to add generic attributes to each vertex. You can set a index that the data will be associated with. However, you can't choose the index arbitrarily, since I discovered that using indices lower than 4 will break standard (Normal/TexCoord) attributes, plus 0 is the vertex position. How can I find out, which will be the first real free index to use for custom attributes?
|
# ? Feb 9, 2009 13:54 |
|
heeen posted:How can I find out, which will be the first real free index to use for custom attributes? http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/attributes.php bottom of the page, there is a table.
|
# ? Feb 9, 2009 14:30 |
|
I seem to have a bug in my ppl shader, but I can't wrap my head around it:code:
|
# ? Feb 9, 2009 20:57 |
|
mat3 tbn=mat3(svec, tvec, ws_normal); Try that.
|
# ? Feb 9, 2009 21:52 |
|
OneEightHundred posted:mat3 tbn=mat3(svec, tvec, ws_normal); thanks, although I found it myself, that was exactly the error
|
# ? Feb 10, 2009 14:37 |
|
How do I make a smaller texture out of an existing loaded texture in openGL? I want to be able to turn a frame in a sprite sheet into a whole texture so I can repeat it over an area, I know it's fairly simple if it's just a single texture so i've been trying to work out how to seperate a section of an existing texture into a new texture handle. I've looked at glCopyTexSubImage2D but it seems to act on the read buffer, is there any way I can do this other than seperating the sprites in the spritesheet into seperate textures at load time?
|
# ? Feb 11, 2009 17:10 |
|
brian posted:How do I make a smaller texture out of an existing loaded texture in openGL? I want to be able to turn a frame in a sprite sheet into a whole texture so I can repeat it over an area, I know it's fairly simple if it's just a single texture so i've been trying to work out how to seperate a section of an existing texture into a new texture handle. I've looked at glCopyTexSubImage2D but it seems to act on the read buffer, is there any way I can do this other than seperating the sprites in the spritesheet into seperate textures at load time? You can change the read buffer to the source texture with the framebuffer object API.
|
# ? Feb 11, 2009 17:21 |
|
I've got a model that rotates along the Y axis and that model has a bounding box defined by a maximum and minimum point that I would like to follow it. I thought that simply transforming the two points by the same rotation matrix would do it but apparently it doesn't work that way. Bounding box without rotation: After rotation: Any ideas on what I actually need to transform it by to keep it inline?
|
# ? Feb 13, 2009 00:41 |
|
You can't really do that because any point on the model can affect the bounds. i.e. a sphere will always have the same box but a diagonal line won't even though they may have the same bounding box at given configurations. Best thing to do would be either precompute the bounding box on given animation frames and expand it a bit if you're compositing animations, or use various extent points (i.e. hands, elbows, head, gut, back, knees, feet) to determine it.
|
# ? Feb 13, 2009 01:29 |
|
The bounding box is already computed per-frame and is interpolated inbetween. I'm simply performing a rotation about the Y axis on the model's world matrix. In fact, this method does in fact work when I transform the bounding box's physical geometry, but I need to get the actual values for my collision testing. edit: I suppose I might as well provide some code. This is the code that sets the position of each of the drawn bounding box's positions: code:
code:
MasterSlowPoke fucked around with this message at 02:04 on Feb 13, 2009 |
# ? Feb 13, 2009 01:54 |
|
MasterSlowPoke posted:The bounding box is already computed per-frame and is interpolated inbetween. I'm simply performing a rotation about the Y axis on the model's world matrix. In fact, this method does in fact work when I transform the bounding box's physical geometry, but I need to get the actual values for my collision testing. Well once you rotate the AA bounding box it's obviously not going to be axis-aligned anymore, so you can't really use it for collisions like that. I guess one cheapo solution would be to take the maximum and minimum of the new and old corner coordinates, per axis, to get a slightly larger AABB of both the original and the rotated BB. Or switch over to something rotation-invariant like bounding spheres... If you actually need the rotated positions of the BB vertices, like what you're calculating in that source snippet, you need to work out the coordinates from min/max first and then transform each one separately. Of course the result is not an AABB so it's useless for cheap collision detection.
|
# ? Feb 13, 2009 06:52 |
|
Ah, of course. Rotating two points won't give me an OBB, and that wouldn't work for my collision detection regardless. Thanks. efficiency MasterSlowPoke fucked around with this message at 13:40 on Feb 13, 2009 |
# ? Feb 13, 2009 12:56 |
I'm trying to do a basic mouse look in DX9, and I'm getting the cursor position in without any problems, but it always rotates about the z-axis no matter what I do. The actual code where I create the transform matrix is this:code:
code:
EDIT: I should also mention that rotating doesn't work at all when I'm moving the mouse along the x-axis. redphoenix11 fucked around with this message at 04:15 on Feb 17, 2009 |
|
# ? Feb 17, 2009 02:52 |
|
I'm pretty sure you don't want to be changing the "up" vector, for one thing.
|
# ? Feb 17, 2009 03:17 |
|
This is how I do a FPS camera. It's in C# but you should be able to translate it.code:
|
# ? Feb 17, 2009 03:41 |
I wasn't setting the view matrix properly and there was some other little problems, I've got this now:code:
|
|
# ? Feb 17, 2009 04:18 |
|
Looks fine to me. Why are you creating the projection matrix every frame, though?
|
# ? Feb 17, 2009 04:47 |
|
I have a camera in OpenGL using the gluLookAt function that is working correctly. The camera rotates around a fixed point at the center of the screen. Is there any way i can lower the center point of the camera on the screen/viewport/window? I don't want to put the center of the camera a few units further on the z-axis because then my object moves when the camera rotates around it. I want the object to always be in the same place, have the camera rotating around it, and to not be at the center of the screen (somewhere in the lower 1/3 of the screen). Any way to do this?
|
# ? Feb 24, 2009 16:09 |
|
Scarboy posted:I have a camera in OpenGL using the gluLookAt function that is working correctly. The camera rotates around a fixed point at the center of the screen. Is there any way i can lower the center point of the camera on the screen/viewport/window? You can just translate up and down to make it seem like the camera is higher or lower. I think you're misinterpreting how the math works out. In the end, after your transformations are applied, the camera is at 0,0,0 looking down the -z axis and everything else has been transformed relative to that. Try thinking about it as if the world is moving around the camera, instead of the camera moving through the world. EDIT: Alternately, you could adjust your viewport - but that might be weird. Spite fucked around with this message at 02:55 on Feb 25, 2009 |
# ? Feb 25, 2009 02:48 |
|
Scarboy posted:I have a camera in OpenGL using the gluLookAt function that is working correctly. The camera rotates around a fixed point at the center of the screen. Is there any way i can lower the center point of the camera on the screen/viewport/window? Not sure what it is that you want (why not just mve the camera slightly up?), but it sounds like an off-center projection matrix. Something like calling glFrustum by hand (or D3DXMatrixPerspectiveOffCenterLH, both the GL and DX references have matrices describing what's going on) with the vertical bounds of the viewing frustum skewed as much as you like.
|
# ? Feb 25, 2009 03:08 |
|
I know the math behind what gluLookAt does, that's why I couldn't wrap my head around how to do it. Thankfully, the second you said off center projection I just smacked myself on the head and said, "oooooooooh, that's why my graphics professor said glFrustum is useful for off center projections" oh so long ago. I've got it working exactly how I want it now, thanks.
|
# ? Feb 25, 2009 06:31 |
|
Is there a straightforward way to draw (rasterized?) 2d quads using pixel coordinates? I'm trying to draw up a menu and some simple 2d graphics on top of a 3d scene. (edit: openGL) Contero fucked around with this message at 05:52 on Mar 6, 2009 |
# ? Mar 6, 2009 05:50 |
|
Use an unprojection matrix to get the world space coordinates for your quads.
|
# ? Mar 6, 2009 08:09 |
|
MasterSlowPoke posted:Use an unprojection matrix to get the world space coordinates for your quads. Wait, you seriously can't use pre-transformed coordinates in OpenGL? It's not even a full line of code to do that in DirectX.
|
# ? Mar 6, 2009 08:28 |
|
Contero posted:Is there a straightforward way to draw (rasterized?) 2d quads using pixel coordinates? I'm trying to draw up a menu and some simple 2d graphics on top of a 3d scene. Here are two basic functions you can use to switch between: code:
Avenging Dentist posted:Wait, you seriously can't use pre-transformed coordinates in OpenGL? It's not even a full line of code to do that in DirectX.
|
# ? Mar 6, 2009 12:02 |
|
Avenging Dentist posted:Wait, you seriously can't use pre-transformed coordinates in OpenGL? It's not even a full line of code to do that in DirectX. You're better off doing it via the unprojection way.
|
# ? Mar 6, 2009 20:59 |
|
krysmopompas posted:Pre-transformed coordinates suck. If you want clipping, not all hardware supports doing the backprojection into clipping space, so it falls back into software and is slow as balls. It sounded like he was making a HUD, where that wouldn't be an issue. Though I suppose you could set all the matrices in the pipeline to identity. Avenging Dentist fucked around with this message at 21:26 on Mar 6, 2009 |
# ? Mar 6, 2009 21:18 |
|
Any suggestions on how I can do some profiling on GLSL code? I got an app running various shaders in succession and I want to see how each frame time is divided between those shaders. I've installed Nvidias Perfkit that comes with the gDEBUGGER app, but I cant say I found out something that helps me out (PerfHUD on the other hand looks awesome...if only I were using DirectX).
|
# ? Mar 24, 2009 20:13 |
|
edit: Got it solved. Apparently [UIImage imageNamed:] does too muh caching, and images are not often released. I'm working on my first openGL game for the iphone. It runs smoothly, and Instrument's leaks application says that I'm not leaking, but watching my app in the Instruments/Activity Monitor, I seem to be using up about two megabytes more of memory every time my level changes. I googled around, and found a suggestion not to use glGenTextures more than once for a texture and to copy the number over and use it in the future, and tried that, but the memory still increases. This is called after each level. When I comment out the CGImageRef, CGContextRef and CGContextDrawImage the leak is removed, but then of course I only get an all black image. If I only comment out CGContextRef and CGContextDrawImage then the leak is still there, which leads me to believe the leak is CGImageRef not being released, but when I try to release it, the app crashes on the second call of setLevelTextures. code:
edit: Solved it with code:
numeric_atrophy fucked around with this message at 12:51 on Mar 25, 2009 |
# ? Mar 25, 2009 11:39 |
|
This isn't 3d or using OGL / DX but I think it is the best topic still. I'm using GDI and a DIB Section to draw on. I thought DIB's are ABGR? RGB(255, 0, 0) seems to give 0x000000FF. Ok... but 0x000000FF appears to be blue. slovach fucked around with this message at 11:01 on Mar 28, 2009 |
# ? Mar 28, 2009 10:55 |
|
slovach posted:RGB(255, 0, 0) seems to give 0x000000FF. Ok... but 0x000000FF appears to be blue.
|
# ? Mar 28, 2009 21:00 |
|
I figured it out. I tried to be cool and shift by 8 instead of dividing by 255. It turned out that 'small inaccuracy' was actually doing a pretty good job of butchering results.
|
# ? Mar 28, 2009 21:30 |
|
Can someone explain to me why gluLookAt doesn't act the way I expect it to?code:
edit: the problem is that the UP vector is just that, a vector, not an offset from position. Works fine with 0,1,0. gently caress I spent way too long fixing this. Tim Berners-Lee fucked around with this message at 06:19 on Mar 30, 2009 |
# ? Mar 30, 2009 04:36 |
|
|
# ? May 16, 2024 18:51 |
|
StickGuy posted:At least with .NET, bitmaps are ARGB. http://msdn.microsoft.com/en-us/library/dd183376(VS.85).aspx quote:The blue mask is 0x000000FF, the green mask is 0x0000FF00, and the red mask is 0x00FF0000
|
# ? Mar 30, 2009 08:35 |