Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Canvas-drawn bitmap and OpenGL texture problem

Canvas-drawn bitmap and OpenGL texture problem

Problems with Canvas, OpenGL, etc...

Canvas-drawn bitmap and OpenGL texture problem

Postby Orionark » Fri Jul 09, 2010 8:18 pm

So I have two ways to create a bitmap:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Bitmap bitmap = Bitmap.createBitmap( _width, _height, Bitmap.Config.ARGB_8888 );
  2. Canvas canvas = new Canvas( bitmap );
  3. Paint paint = new Paint();
  4. paint.setARGB( 255, 255, 0, 255 );
  5. paint.setShader( new RadialGradient( _width/2.0f, _height/2.0f, ( _width > _height ? _width : _height ) / 2.0f, 0xFFFF0000, 0xFF880000, Shader.TileMode.CLAMP ) );
  6. canvas.drawRect( 0, 0, _width, _height, paint );
  7. Bitmap use = Bitmap.createBitmap( bitmap, 0, 0, _width, _height );
Parsed in 0.015 seconds, using GeSHi 1.0.8.4


That draws a simple radial gradient onto a bitmap.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. InputStream is = context.getResources().openRawResource(R.drawable.glass);
  2. Bitmap bitmap = null;
  3. try {
  4.         //BitmapFactory is an Android graphics utility for images
  5.         bitmap = BitmapFactory.decodeStream(is);
  6.  
  7. } finally {
  8.         //Always clear and close
  9.         try {
  10.                 is.close();
  11.                 is = null;
  12.         } catch (IOException e) {
  13.         }
  14. }
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


That's from the INsanityDesign NeHe ports. My problem is that the second one, when applied to an OpenGL texture, actually works, but the canvas-drawn bitmap does not, and there's no error or explanation why.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. gl.glBindTexture( GL10.GL_TEXTURE_2D, texture );
  2. gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST );
  3. gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST );
  4. GLUtils.texImage2D( GL10.GL_TEXTURE_2D, 0, use, 0 );
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


That's the code I'm using to bind it and draw it. Any help would be appreciated.
Orionark
Freshman
Freshman
 
Posts: 2
Joined: Fri Jul 09, 2010 8:13 pm

Top

Re: Canvas-drawn bitmap and OpenGL texture problem

Postby Orionark » Fri Jul 09, 2010 11:36 pm

Nevermind, it's because my texture dimensions aren't coming out to a power of 2.
Orionark
Freshman
Freshman
 
Posts: 2
Joined: Fri Jul 09, 2010 8:13 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest