We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › opengl + PImage + glTexImage2D
Page Index Toggle Pages: 1
opengl + PImage + glTexImage2D (Read 1400 times)
opengl + PImage + glTexImage2D
Nov 24th, 2006, 8:15pm
 
hello there,
ive been looking for info about this for sometime..

i always get an error on one line of a Texture class im trying to compile..
i think the problem is in PImage pixels member but im not sure.. hope anyone have some idea why this line fails to compile.. opengl reference says nothing about long for bitmap data


opengl.glTexImage2D( GL.GL_TEXTURE_2D, 0, 0, width, height, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, pixels );    


this is the error:

Semantic Error: No applicable overload for a method with signature "glTexImage2D(int, int, int, int, int, int, int, int, int[])" was found in type "javax.media.opengl.GL". Perhaps you wanted the overloaded version "void glTexImage2D(int $1, int $2, int $3, int $4, int $5, int $6, int $7, int $8, long $9);" instead?

thanks in advance
Re: opengl + PImage + glTexImage2D
Reply #1 - Nov 24th, 2006, 8:47pm
 
Trying to use native GL calls from within processing can be problematic.

This however doens't look like one of the cases, you need to add:

Code:
import java.nio.*;

//rest of code ...
IntBuffer pixBuffer=IntBuffer.wrap(pixels);
pixBuffer.rewind();
opengl.glTexImage2D(GL.GL_TEXTURE_2D, 0, 0, width, height, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, pixBuffer);


If in doubt about JOGL versions of GL calls, get a copy of the JavaDOC: http://download.java.net/media/jogl/builds/archive/jsr-231-1.0.0/jogl-1_0_0-docs.zip
Re: opengl + PImage + glTexImage2D
Reply #2 - Nov 25th, 2006, 6:41pm
 
hi john.. thanks for the info

i appreciate it !
Page Index Toggle Pages: 1