Jump to content


Snoob

Member Since 26 Jan 2012
Offline Last Active Yesterday, 03:19 PM
-----

Topics I've Started

MinGW64 and GLES2 emulator?

17 May 2013 - 11:14 AM

As of late I support the c++11 standards in my project. To get full c++11 support I've switched my MinGW environment from 32bit to 64bit. Now I use the MinGW-build environment with GCC 4.8. I could build and compile anything of my sources. But since few days I'm fighting with GLES2 emulation support.

I've downloaded and integrated the latest PVRFrame GLES2 x64 libraries to my MinGW64 environment. I could compile my GLES2 sources without any failure. But on runtime my application crashes if I try to crate a VBO:

Quote

[Fri May 17 11:09:15 2013]: OpenGLES2.0 demo v1.0
[Fri May 17 11:09:15 2013]: EGL version: 1.3
[Fri May 17 11:09:15 2013]: Driver vendor: Imagination Technologies (Host: (null))
[Fri May 17 11:09:15 2013]: OpenGL version: OpenGL ES 2.0 (Host: (null))
[Fri May 17 11:09:15 2013]: Graphics card : PVRVFrame 9.4 - Host (OpenGL) (Host: (null)) (SDK Build: 3.0@2224087)
[Fri May 17 11:09:15 2013]: Supported OpenGL ES extensions :
-GL_OES_byte_coordinates
-GL_OES_fixed_point
-GL_OES_query_matrix
-GL_OES_single_precision
-GL_OES_matrix_get
-GL_OES_read_format
-GL_IMG_read_format
-GL_OES_point_sprite
-GL_OES_query_matrix
-GL_OES_texture_env_crossbar
-GL_OES_texture_mirrored_repeat
-GL_OES_blend_subtract
-GL_OES_blend_func_separate
-GL_OES_blend_equation_separate
-GL_OES_stencil_wrap
-GL_OES_extended_matrix_palette
-GL_OES_compressed_ETC1_RGB8_texture
-GL_OES_compressed_paletted_texture
-GL_OES_depth_texture
-GL_OES_required_internalformat
-GL_EXT_discard_framebuffer
-GL_OES_texture_cube_map
-GL_OES_fragment_precision_high
-GL_OES_element_index_uint
-GL_IMG_texture_compression_pvrtc
-GL_OES_mapbuffer
-GL_EXT_multi_draw_arrays
-GL_OES_standard_drivatives

[Fri May 17 11:09:15 2013]: EGL window created.
[Fri May 17 11:09:15 2013]: EGL windows surface created.
[Fri May 17 11:09:15 2013]: EGL render context created.

Try to generate buffer.
(Error) The following error occurred in glGenBuffers: (502) GL_INVALID_OPERATION
Buffer generated

I simple call:

GLuint vertexBuffer;
glGenBuffers (1, &vertexBuffer);

As you can see, the OpenGLES2 environment is set up correctly. I could check the GLES2 extensions and successfully initialize and create the required EGL objects (Display, Window, RenderContext). But if I call a standard OpenGL Extensions, this call fails (same also on GLSL shader object creation). My GLES2 sources are correctly, I use the same sources on Android ADT platform, without any issue.

Has someone experience with MinWG64 and GLES2 set up?
Thanks for any hint or help.

Issue with dynamic VertexBuffer reuse in Direct3D9

06 January 2013 - 07:14 AM

In my application I create a simple dynamic vertex buffer :

// calculate the number of bytes of data
size = m_sizeVertex*m_numVertices;

HRESULT hr = d3ddev->CreateVertexBuffer(size,
						D3DUSAGE_DYNAMIC,
						0,   // DON'T pass the FVF code we using vertex decleration
						D3DPOOL_DEFAULT,
						&m_buffer,
						NULL);

I add data to my buffer in this way:

writeData(unsigned int offset, unsigned int length, void* data)
{						  
	 // store the length of actual data length
	 m_length = length;
	  
	 // determine required buffer size in bytes
	 unsigned int size = length*m_sizeVertex;
	  
	 // lock v_buffer and load the vertices into it
	 void* vertices = 0;
	 HRESULT hr = m_buffer->Lock(offset, size, &vertices, D3DLOCK_DISCARD);
	 if (FAILED(hr)){
		   throw exception("Could not lock buffer!");
	 }

	 memcpy(vertices, data, size);

	hr = m_buffer->Unlock();
	if (FAILED(hr)){
		   throw exception("Could not unlock buffer!");
	}
}

Everything is working fine until I try to reuse the buffer, which has rendered other data before. In that case I got fragments of the old render data as garbage between new render data. If I everytime create a new buffer on data switch anything is working fine. It looks to me that the discard flag is ignored.

Thanks for any help.

font texture artifacts

02 January 2013 - 11:05 PM

I've implemented a FreeType font renderer. Using OpenGL anything looks like expected, but when I try to render same text with Direct3D9 i got some texture artifacts.
The text looks like cut of at bottom and some letters contains texture fragments at the border edges:

http://s7.directuplo...7c6y54l_jpg.htm Test text rendered with OpenGL
http://s1.directuplo...2ksd9fy_jpg.htm Test text with artifacts rendered with Direct3D9

I use Bilinear filtering (linear/linear/point) and set UV texture addressing mode to CLAMP. First I thought there may be addressing failures and also test
WRAP and BORDER, but I got same issues.

The letters I use for text rendering are rendered to an atlas texture. Could it possible I got those artifacts while I do not use padding space between
the lettes in this atlas texture? If it so, why only on D3D9? Any ideas what could be wrong?

Effective way to compute texture size for bin packer

06 June 2012 - 08:41 PM

I've implemented a rectangle based bin packer to create a texture atlas for font glyphs. This packer works well but requires the width and height of the target area.

Actually I try to approximate the minimal pow2 texture by iterating over my set of target glyps and check if their right and bottom margins fits to the target texture size. If the size exceeds I double the size and check again. This works but results often in wasted space after bin packing.

But what is a more effective way to compute the target texture size? Actually I've thoughts about a "dry bin pack run" to check the glyphs against the target size and extends the size by two if a glyph doesn't fit and check again... But this will result in multiple bin pack runs. Is this not too expensive?

Best regards,
Snoob