Jump to content

  • Log In with Google      Sign In   
  • Create Account

Seabolt

Member Since 26 May 2010
Offline Last Active Aug 21 2014 03:05 PM

Topics I've Started

Is it possible to render from another thread without OpenGLES

05 March 2014 - 06:31 PM

Okay, so here is what I'm trying to accomplish:

 

I want to render a loading screen using textures directly to the back buffer without going through OpenGL, this way the context thread can be spent actually loading the context resources.

 

Ideally it would be something that I can run in a thread parallel to the context thread and render at regular intervals without delaying the loading thread too much.

 

I understand that you can do shared contexts in some cases, but I also understand that support for such a thing is sketchy at best, even among 3.0+ devices. 

 

I could render an image, swap and then load my resources, but the display would be stale. If possible I'd like to avoid that.

 

Is it possible to reliably and portably render from another thread? Do I just need to bite the bullet and litter my code with updates to a loading screen? That seems non-optimal.


[ANDROID NATIVE ACTIVITY] Resume message is followed by window destruction

16 February 2014 - 12:00 PM

Hey guys,

 

For some reason on a Nexus 7 device, I'll occasionally get a resume command and then at some after or during the command, I'll get a window destroyed command. This is an issue because I need to flag that it's safe to render again after the resume command, but then the device is killed.

 

Is this supposed to happen, am I not releasing correctly, or should I be handling the resume command differently?

 

I'm working on a project with a tight NDA so I can't say much, but please give me any ideas you might have.


Android NDK touch coordinates

12 December 2013 - 03:29 PM

Hey guys, I have a question.

 

I'm currently trying to get touch to work on Android using the NDK with the android_native_app_glue. 

 

When I get a touch event, the coordinates seem to be divided by two. So what should be 1100 on the x is being returned as 550.

I've tried multiplying the getPrecision functions on to the returned value from AMotionEvent_getRawX and it's still the same.

Anyone have any ideas as to what may be causing it?

 


glFramebufferRenderbuffer kills glFramebufferTexture

25 October 2013 - 06:39 PM

Hey guys,

I have a little test right now. Basically if I don't bind a depth render target, the color buffer get's written to. If I bind one, the color buffer does not.

Renderbuffer code:

		pglBindRenderbuffer( GL_RENDERBUFFER, m_PlatformData.m_TargetHandle );
          	GL_ERROR( "Failed to bind the renderbuffer" );
		pglFramebufferRenderbuffer( GL_FRAMEBUFFER,
			GL_DEPTH_STENCIL_ATTACHMENT,
			GL_RENDERBUFFER,
			m_PlatformData.m_TargetHandle );
		GL_ERROR( "Failed to attach the render buffer to the frame buffer" );

Texture code:
 

pglFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_Texture->m_Texture, 0 );
GL_ERROR( "Failed to set the render target as a texture" );

Does anyone have any ideas as to why this may be happening?

 


FBO rendering behavior

25 October 2013 - 03:58 PM

Hey guys, I have some questions about how an FBO may work.

I'm trying to incorporate FBOs into an existing rendering pipeline. To maintain current architecture I'm trying to use only one FBO for the program. I know it may not be ideal, but it should still work, (unless someone knows a better way to do MRT in OpenGL). I really can't know about any other targets I may be bound with when I create the render target, so I'm creating them and attaching them to the FBO later on.

So my current path is like such:

If it's a color target: Create a texture.

If it's a depth target: Create a renderbuffer.

Then when I bind the targets for a draw:
Bind a framebuffer
For each color target
     If it's a color target.
         Attach my texture to the frame buffer
    If it's a depth target
        Attach my renderbuffer to the frame buffer
Enable the draw buffer for any color target attachments

This runs with no problems, but in gDebugger I don't see anything being drawn to my color target's texture. Any ideas?

 

//
// Create our gl texture handle
//

glGenTextures( 1, &texture->m_Texture );																	
GL_ERROR( "Failed to generate render target texture" );
glBindTexture( GL_TEXTURE_2D, texture->m_Texture );															
GL_ERROR( "Failed to bind the render target texture when initializing" );

//
// Set the texture data parameters and some filtering data.
// TODO: We need to pass in platform agnostic filtering information here.
//
	
GLenum platformFormat = GetPlatformTextureFormat( format ); 
GLenum imageFormat = GetOpenGLImageFormat( platformFormat );
GLenum componentType = GetOpenGLComponentType( platformFormat );
glTexImage2D( GL_TEXTURE_2D, 0, platformFormat, width, height, 0, imageFormat, componentType, 0 );			
GL_ERROR( "Failed to set the texture image parameters for a render target texture" );

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);										
GL_ERROR( "Failed to set the filtering parameters for a render target texture" );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);											
GL_ERROR( "Failed to set the filtering parameters for a render target texture" );

and for depth stencil render targets I use this code:

 

pglGenRenderbuffers( 1, &m_PlatformData.m_TargetHandle );				
GL_ERROR( "Failed to generate render buffer handle" );

pglBindRenderbuffer( GL_RENDERBUFFER, m_PlatformData.m_TargetHandle );		
GL_ERROR( "Failed to bind the render buffer" );

pglRenderbufferStorage( GL_RENDERBUFFER, platformFormat, width, height );	
GL_ERROR( "Failed to set render buffer storage" );
		
pglBindRenderbuffer( GL_RENDERBUFFER, 0 );		
pglBindFramebuffer( GL_FRAMEBUFFER, m_FrameBufferObject ); 
GL_ERROR( "Failed to bind context frame buffer" );

int numDrawBuffers = 0;
GLenum drawBuffers[ VTG_MAX_RENDER_TARGETS ] = {GL_COLOR_ATTACHMENT0};
for( int currentTarget = 0; currentTarget < VTG_MAX_RENDER_TARGETS; ++currentTarget )
{
	if( m_BoundRenderTargets[ currentTarget ] )
	{
	        m_BoundRenderTargets[ currentTarget ]->Bind( currentTarget );
		drawBuffers[ currentTarget ] = GL_COLOR_ATTACHMENT0 + currentTarget;
		numDrawBuffers++;
	}
}

pglDrawBuffers( numDrawBuffers, drawBuffers );	
GL_ERROR( "Failed to specify draw buffers" );

if( m_BoundDepthTarget )
{
	m_BoundDepthTarget->Bind( -1 );
}

//
// Now we need to make sure we are complete.
//

CheckForCompleteness();

The bind function for a render target looks like this: 

 

	if( m_Texture )
	{
		//glBindTexture( GL_TEXTURE_2D, m_Texture->m_Texture );	
                GL_ERROR( "Failed to bind the texture" );
		pglFramebufferTexture2D( GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, m_Texture->m_Texture, 0 );
		GL_ERROR( "Failed to set the render target as a texture" );
	}
	else
	{
		//
		// Attach to the currently bound frame buffer object.
		// TODO: Need some way to ensure there is an FBO bound...
		//

		pglFramebufferRenderbuffer( GL_FRAMEBUFFER,
			attachment,
			GL_RENDERBUFFER,
			m_PlatformData.m_TargetHandle );
		GL_ERROR( "Failed to attach the render buffer to the frame buffer" );
	}
			
GL_ERROR( "Failed to bind the default back buffer" );

This code executes with no problem. Then when I update all render targets I do this code:

 


 


PARTNERS