Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Jul 1999
Offline Last Active Jan 26 2015 10:35 PM

Topics I've Started

Manual MipMap Generation

16 January 2015 - 11:26 PM

I am trying to manually render my own Mip Map chain using a framebuffer object.  It works on the first pass (for the first level of mipmaps), but doesn't output anything on subsequent passes.  I set it up like:

	glBindFramebuffer(GL_FRAMEBUFFER, fboID);
	glBindTexture(GL_TEXTURE_2D, texID);

	for(unsigned int i = 1; i < 10; i++)
		unsigned int Dim = (512 >> i);
		glViewport(0, 0, Dim, Dim);
		glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texID, i);

		// <-- Render Quad -->

So when I look at my texture, Level 0 is the source texture I expect, and level 1 has the correct 1st mipmap rendered... but every level from 2 on up is blank.  It's as if the render never happened and the program never ran.  If I modify the loop to start at 2, or 3, etc., then I see that mipmap level rendered correctly.  What gives?


CubeMap Coordinates

15 January 2015 - 09:52 PM

I'm trying to manually render the mipmap levels of a cubemap.  First I rendered level 0 of the cubemap by setting up a framebuffer and passing 6 projection/modelview matrices to a geometry shader, duplicating the triangles for each face.  Next I attached level 1 of the cubemap and bound the same texture as the input to the pixel shader.


And then i realized that I need a float3/vec3 to sample the cubemap.  Is there a good way to create this to sample the 6 faces cleanly?  Or do I need to re-evaluate my setup and attach each face independently...?

Uniform Block Binding Points

10 January 2015 - 05:05 PM

Right now in my code, I get all my uniform block locations with calls to "glGetUniformBlockIndex" and "glUniformBlockBinding".  This requires me to know the name of the uniform block in my C++ code.  I would like to use just the reflection, get all the uniform block binding locations, and bind my uniform buffer objects in a known sequential order.


I thought all I would have to do is:


layout(binding = 0, std140) uniform ProjectionMatrixBlock
    mat4 ProjectionMatrix;

layout(binding = 1, std140) uniform ModelViewNormalMatrixBlock

    mat4 ModelViewMatrix;
    mat4 NormalMatrix;




However, this doesn't work.  Whenever I query the block locations after explicitly setting the binding locations, it always puts the first block in the file last.  All the ones after it are in the expected order, but the first block is always last (per file, so the vertex shader and pixel shader independently order their uniforms with the first one last and the rest in sequential order).


What the heck is going on with this?  And is there a better way to bind uniform buffer objects without having to explicitly call out the name of the block?

Linking a static library to my static library

21 December 2014 - 08:44 AM

I have created 2 libraries, a DirectX wrapper library and a more generic Graphics library.  My application links to the Graphics library, which in turn links to the DirectX wrapper library.


What I wanted to do was to link the DirectX wrapper library directly to things like d3d11.lib, then link the Graphics library to the DirectX wrapper library.  Then my application could just use the Graphics library without having to worry about d3d11.lib and the requisite header/lib paths.


This results in a plethora of these warning: warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in...; second definition ignored


Google searches on the topic reveal a lot of people sternly advising that you do not want to link static libraries to other libraries.  I'm having a hard time understanding why that's such a horrible thing to do.  If the underlying library changes and it breaks my code, it's going to break it whether I'm linking to the library or to the application directly.  I like how clean it is for the application to just link to a single library rather than all the necessary underlying components.


But I don't like seeing compiler warnings junking up my output.  Anyone have any insight on this?

Direct2D kills my CriticalSection...?

11 December 2014 - 09:24 PM

I have an Application, running on Windows 7, compiled with Visual Studio 2013.  It uses sockets to interact with another program.  That program sends one string to this program, who has a "receiver" thread running that stores the string into a queue. The receiver thread calls EnterCriticalSection, puts the string in the queue, and then calls LeaveCriticalSection.  In the main thread of the program, it calls TryEnterCriticalSection before checking this queue and retrieving the string, and then calls LeaveCriticalSection.


This all worked beautifully every time I tried it.  Then I added a minimal Direct2D rendering to the program and it stopped working!  Literally, all I'm doing extra now is calling:





And now it never succeeds on the TryEnterCriticalSection calls!  Has anyone seen anything like this before?