Java.SWT.OpenGL

Started by
3 comments, last by hoofmen 19 years, 7 months ago
I have been working on the swt tutorials, but seems that doing texture mapping with swt its a little different than doing it with C + SDL, actually i couldnt find in SWT API, a way to get the BytesPerPixel of the Image Object. so i am just loading BMP images because i know that the BytesPerPixel (in SDL for a bmp) is 3, well i`ll see how it goes.
Advertisement
I couldn't even find the SWT API. But if you were using:

java.awt.Image.* I could tell ya in a jiffy. Can you give me a link or whatever for the SWT API. thanks
Whatsoever you do, do it heartily as to the Lord, and not unto men.
Hi, here is the swt api:
http://download.eclipse.org/downloads/documentation/2.0/html/plugins/org.eclipse.platform.doc.isv/reference/api/

and i am using org.eclipse.swt.graphics.Image.*;
i am not using awt for some reason gl4java didnt work on my pc.

thnx.
found it.

my java is a little rusty, but something along these lines should work:

import org.eclipse.swt.graphics.*import org.eclipse.swt.graphics.Image.*Image i = new Image(device, "C:\\picture.bmp");ImageData data = i.getImageData();int BytesPerPixel = data.depth / 8;//WALLA SHALLA BOOM BANG, THERE YOU GO   : )



keep in mind that this is true:

" Note that for 16 bit depth images the pixel data is stored in least significant byte order; however, for 24bit and 32bit depth images the pixel data is stored in most significant byte order."


edit: depth is actually bits per pixel, so divide by 8.

[Edited by - Luke Miklos on August 30, 2004 12:43:31 PM]
Whatsoever you do, do it heartily as to the Lord, and not unto men.
Thank you luke. it worked perfectly. i will see how i go on the others...

This topic is closed to new replies.

Advertisement