I would like to render an image buffer in Java (NDK is no option in this case) and pass it to shaders via GL_TEXTURE_EXTERNAL_OES.
glTexImage2D does not work, as mentioned in the spec. But the function glEGLImageTargetTexture2DOES is only available via the GLES11Ext class, which seems kind of wrong to use.
Anyway, I tried and it gives me GL_INVALID_OPERATION, which should happen if:
If the GL is unable to specify a texture object using the supplied
eglImageOES (if, for example, refers to a multisampled
eglImageOES), the error INVALID_OPERATION is generated.
Sadly I cannot make heads or tails from this description, especially since the Android Java API doesn't seem to give me access to eglImageOES functions. Neither have I found a Java example for the usage of this function.
Attached a small example:
// Bind the texture unit 0
GLES20.glActiveTexture( GLES20.GL_TEXTURE0 );
throwOnError( "glActiveTexture" );
GLES20.glBindTexture( GL_TEXTURE_EXTERNAL_OES, _samplerLocation );
throwOnError( "glBindTexture" );
// _output is ByteBuffer.allocateDirect(pixels * Integer.SIZE / Byte.SIZE).order(ByteOrder.nativeOrder()).asIntBuffer()
_output.rewind();
_output.limit( pixels );
GLES11Ext.glEGLImageTargetTexture2DOES( GL_TEXTURE_EXTERNAL_OES, _output );
throwOnError( "glEGLImageTargetTexture2DOES" ); // <-- throws
GLES20.glDrawArrays( GLES20.GL_TRIANGLE_STRIP, 0, 4 );
throwOnError( "glDrawArrays" );
Did anyone do that before or know whether this is possible or not?
EDIT:
I had a look at glEGLImageTargetTexture2DOES implementation and it seems that I have to correctly setup the buffer. Added that, but still same error.
There are some comments in this page which might help:
http://developer.android.com/reference/android/graphics/SurfaceTexture.html
Related
I am creating an Android App that accesses the HERE Platform Data Extension Api (= PDE). Therefore I first load a map centering on my current location. This works fine so far. Then I try to load data from the PDE for the layer "SAFETY_ALERTS", but I get a 400 Error there with the message "tilexy lists 992 tiles but the limit is 64 tiles".
I am not sure where this "tilexy" comes from. I already researched through as much documentation of the PDE as I could find online, but I couldn't find an answer.
Set<String> layers = new HashSet<>(Arrays.asList("SAFETY_ALERTS"));
GeoBoundingBox bbox = map.getBoundingBox();
final PlatformDataRequest request = PlatformDataRequest.createBoundingBoxRequest(layers, bbox);
request.execute(new PlatformDataRequest.Listener<PlatformDataResult>() {
#Override
public void onCompleted(PlatformDataResult platformDataResult, PlatformDataRequest.Error error) {
if (error == null) {
//do something
} else {
//show error --> Here is where I get
}
I expected to get a PlatformDataItemCollection, which is a List of PlatformDataItems (they implement Map). Instead I got the 400-Error.
Does somebody know where this error comes from and can help me fix my mistake?
As per the error message, it would be advisable to check the API call as it seems that more than 64 coordinates has been passed in tilexy parameter in the rest call. tilexy is a string, which is passed in comma separated sequence of tilex,tiley pairs for the requested tiles. The tilex and tiley values are described in the "tile" resource.
please refer following documentation for more reference
developer.here.com/documentation/platform-data/topics/example-tiles.html
Happy Coding..!!
I have to refactor and migrate legacy code from pre 2010. Documentation is bad and I am pretty new to RCP and BIRT coding as well.
The thing is, that we replaced the broken ant build process with a maven tycho process and we got a running application. Now i need to fix a report which somehow does not get displayed and we dont know why.
ExtendedItemHandle eih = elementFactory.newExtendedItem( null, "Chart" );
The newExtendedItem method returns null for some unknown reason and I cant figure out why. Since the code is so old i figured it may have something to do with the target platform, but I dont know where to look. Any suggestions?
EDIT:
I should probably give some context:
// A session handle for all open reports
SessionHandle session = new DesignEngine( null ).newSessionHandle( (ULocale) null );
// Create a new report
reportDesignHandle = session.createDesign( );
// Element factory is used to create instances of BIRT elements.
elementFactory = reportDesignHandle.getElementFactory( );
It was a missing plugin. I dont know, which one, but eventually adding the whole target platform to my running configuration fixed it.
In my code I've a thread waiting for events on a ZeroMQ endpoint, and its main loop looks similar to this:
while (externalCondition) {
byte[] bytes = subscriber.recv(0);
// Do things
}
The problem is that I don't know how to interrupt the call to .recv() method, if I want to exit the thread (for example because I want to shut down the app).
I tried to interrupt the thread but this seems not to work.
Welcome to ZeroMQ and distributed system architectures.
There is no cheap way to interrupt such call ( except a brutal one ), yet
there is an easy way to re-factor the idea, so as it can work in distributed system realms:
/* THIS CODE IS NOT A COPY+PASTE SYNDROME-PROOF, BUT HAS THE DESIGN IDEA CLEAR,
CODE IS NOT A READY TO RUN, AS THE TARGET LANGUAGE
AND THE ACTUAL ZeroMQ BINDING / VERSION
WILL DECIDE ON FURTHER DETAILS TO CODE IN
*/
while ( True ) { // -[NEVER-BLOCK]----------- aSoftRealTIME-control-loop-<body>--
bool ec = externalCondition;
int rc = subscriber.poll( someSoftRealTimeDELAY_in_ms );
if ( ec
& rc == 0
){
//--------------------------------------------------
// DO NOTHING, AS THERE IS NOTHING TO WORK ON
// or sleep, or
// DO ANY SoftRealTime-controlled / yet interruptible
// maintenance workpackage(s)
//-------------------------------------------------------
}
if ( !ec ){
break; // __________________________ J.I.T. / JMP / RET __^
}
if ( rc < 0 ){
// ZeroMQ .poll() Error Analysis & Error Recovery
}
if ( rc > 0 ){
// ZeroMQ has a thing to indeed .recv(), so read it:
byte[] bytes = subscriber.recv( zmq.DONTWAIT );
... // DO things ... on bytes ...
}
} // ---------------[NEVER-BLOCK]----------- aSoftRealTIME-control-loop-<body>--
Nota bene
while this remark might be a fairly well know subject for you, in case you have already got familiar with ZeroMQ internalities and various defaults, yet, let me mention it also here, as not all kind reader may have such deep ZeroMQ practice.
The SUB-side(s) of the Scalable Formal Communication Pattern used above has a dark-side. Unless one explicitly "subscribed" to some newspapers and/or magazine(s), there will nothing arrive into one's SUB-side mailbox, nothing gets delivered at all, as the "delivery service" has not received any subscription from you, telling 'em what you would like to ( receive ) and read
So, always do not forget to submit a call to such a
subscriber.setsockopt( aSubject_What_To_Subscribe_To_Indeed_Receive_STRING );
Not having done so, one will never .recv() a single byte.
Thanks. What would be the "brutal" one? –Alessandro Polverini 23 hours ago
Well, ZeroMQ native API, as of 2018-Q1 permits one, rather brutal way to achieve an enforced interruption of a blocking call to .recv() method - calling a <Context>.term() - so, it works more less like a "Demolition Man" when asking just for a few pieces of paper ... indeed that way, plus there are further pre-requisities not to hang your further code-execution in an uncontrolled zombie-alike state, if not infinitely ( if not having protected all your Socket-instances generated from native-API with an immediately configured .setsockopt( zmq.LINGER, 1 ) ( since native API 2.1+ ~ 4.(?) where a promised change of defaults was published ... respective language binding / wrappers differ in version adoption, so cannot refer in general and best check the jeromq right upon instantiations took place with published .getLinger()-exposed method to see this reactively per-incident :o) ).
Calling a WMD-alike annihilation, using .term()-method, will in those cases, where Socket-instances were not left waiting ( indeterminatly, if not infinitely ) by zmq.LINGER-instance attribute, cancel internal-FSA and exit even the still blocked-{ .recv() | .send() | poll() }-s and return the code-execution control-path to your "Demolition Man"-controls :o)
Doable, but a bit harsh, isn't it?
I'm trying to create an SNMP4j agent and am finding it difficult to understand the process correctly. I have successfully created an agent that can be queried from the command line using snmpwalk. What I am having difficulty with is understanding how I am meant to update the values stored in my implemented MIB.
The following shows the relevant code I use for creating the MIB (I implement Host-Resources-MIB)
agent = new Agent("0.0.0.0/" + port);
agent.start();
agent.unregisterManagedObject(agent.getSnmpv2MIB());
modules = new Modules(DefaultMOFactory.getInstance());
HrSWRunEntryRow thisRow = modules.getHostResourcesMib().getHrSWRunEntry()
.createRow(oidHrSWRunEntry);
final OID ashEnterpriseMIB = new OID(".1.3.6.1.4.1.49266.0");
thisRow.setHrSWRunIndex(new Integer32(1));
thisRow.setHrSWRunName(new OctetString("RunnableAgent"));
thisRow.setHrSWRunID(ashEnterpriseMIB);
thisRow.setHrSWRunPath(new OctetString("All is good in the world")); // Max 128 characters
thisRow.setHrSWRunParameters(new OctetString("Everything is working")); // Max 128 characters
thisRow.setHrSWRunType(new Integer32(HrSWRunTypeEnum.application));
thisRow.setHrSWRunStatus(new Integer32(HrSWRunStatusEnum.running));
modules.getHostResourcesMib().getHrSWRunEntry().addRow(thisRow);
agent.registerManagedObject(modules.getHostResourcesMib());
This appears to be sufficient to create a runnable agent. What I do not understand is how I am meant to change the values stored in the MIB (how do I, for example, change the value of HrSWRunStatus). There seem to be a few kludge ways but they don't seem to fit with the way the library is written.
I have come across numerous references to using/overriding the methods
prepare
commit
undo
cleanup
But cannot find any examples where this is done. Any help would be gratefully received.
In protected void registerManagedObjects(), you need to do something like new MOMutableColumn(columnId, SMIConstants.SYNTAX_INTEGER, MOAccessImpl.ACCESS_READ_WRITE, null); for your HrSWRunStatus. Take a look at the TestAgent.java example of SNMP4J-agent source.
I'm working with the PSJOA library. I have a Java app, and I'm testing each of the standard operations using the CI_PERSONAL_DATA. Everything works fine with the Get, Find and Save. But not with the Create, even though when I invoke the method, I get an OK response, with no apparent errors. The input parameter I'm sending (taken from the CreateKeys) is the KEYPROP_EMPLID.
The odd thing here is that, if instead I call the Create method using Web Services (through SoapUI), the new instances is correctly created. However, in this scenario, passing just the primary key KEYPROP_EMPLID is not enough and I have to fill more fields (as it I was performing an update).
Can someone point to me what might be happening? Is there some missing data? Maybe I misunderstood the creation behavior?
Thanks.
What exactly goes awry when you call create? That will create a new entry in the personal data component in PeopleSoft for the person with the supplied emplid. It will be editable, so you can fill in other information, but it will not persist until/unless you call save() afterwards.
Does the emplid already exist in the personal data component? If so, you should be calling get() instead.
Does the emplid already exist in the peoplesoft instance? If not, you should make sure it is in the system prior to using it.
Regarding the lack of error behavior, I have found the peoplesoft component interface APIs for java are notoriously unreliable. You can test them in real time through Application Designer (Via the "Test Component Interface" option in the drop-down menu), which I often find helpful.
Finally, calling session.checkMessages() on your session after performing a method on a CI can often generate error messages that otherwise will not be displayed.
EDIT: Here is a snippet of how we typically call/use it in our PeopleSoft HR instance:
ICiPersonalData wh = (ICiPersonalData)ses.getComponent("CI_PERSONAL_DATA");
if (wh == null) throw new UpdateException("Failed to get component");
wh.setInteractiveMode(true);
wh.setGetHistoryItems(true);
wh.setEditHistoryItems(true);
wh.setKeypropEmplid(emplid);
if (!existsInHR(emplid)) { // Direct database check
LOG.debug("Creating a new HR person.");
if ( ! wh.create() )
LOG.warn("wh.create returned false for emplid ="+emplid);
ses.checkMessages(); // will throw exception if errors exist
wh.setPropDerivedEmp("Y");
rs.put("NEW","Y");
setKeyPersonalData(wh, emplid, rs); // Sets name, etc.
} else {
if (!wh.get())
LOG.warn("wh.get returned false for emplid ="+emplid);
ses.checkMessages();
}