Hi Michael, Tomi,

The ARGB order is what most hardware uses internally anyway.

Therefore, modern wisdom is not to convert to rgba but rather use
texture modes GL_BGRA with GL_UNSIGNED_INT_8_8_8_8_REV.

But in my experience that turns out not to work on some implementations, even 
ones which advertise
OpenGL 1.2 support. Great. I went back to explicit byte swizzling in Racket. At 
least it works.


Stephan

On 03/26/2012 06:10 PM, Michael W wrote:
I'd also love to know if there's a better way. A
bitmap%->opengl-tex-handle function would be absolutely
scrumptious.

Part of the reason seems to be that Racket stores images as ARGB
bytes, but OpenGL doesn't support that, hence the need for all
the byte swizzling.

For what it's worth, I have some (lousy) example code that draws
our beloved (standard-fish) to an OpenGL texture, just copying
the argb bytes to a new buffer and loading that. It's
horrible--useless comments abound and mutation everywhere---and
it's exactly what you said you didn't want, but in case you need
it: https://gist.github.com/2206165

2 hours ago, Tomi Neste wrote:
Hi!

I'd need to use bitmaps rendered with the graphics toolkit as OpenGL
textures in a GL context created by a foreign library (like GLFW, for
example). I was looking through the documentation but couldn't any
information on how to bind Racket bitmaps as GL textures. The SGL
examples seem to do a byte-by-byte copy of a Racket byte-vector
acquired with get-argb-pixels which seems redundant and slow since I
assume the bitmap is already stored in some format that could be
directly used by OpenGL texture creation functions.

So, is there a way to get a foreign pointer to the bitmap data (and
format information) or is there some other way to accomplish what I'd
need?



____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to