Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How to go from Texture Id to Texture object?  (Read 2083 times)
0 Members and 1 Guest are viewing this topic.
Offline sgthale

Senior Newbie

« Posted 2012-04-29 03:09:56 »

When I use glGenTextures(). It only returns an int and not the texture itself. I want to keep track of all textures in an array but I have no way of storing it because only returns an integer. How do I go about doing this? Do I even need to do this?
Offline lhkbob

JGO Knight

Medals: 32

« Reply #1 - Posted 2012-04-29 04:56:00 »

glGenTextures() is only supposed to return an integer.  It generates a unique id you can use for a new texture object.  The "texture object" is an object stored by OpenGL on the graphics card, it is not the same thing as any Java type named Texture (these would just wrap an integer received from glGenTextures() anyway).

Why can't you just store the texture id in the array?

Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

« Reply #2 - Posted 2012-04-29 05:24:59 »

I don't think he even understand how textures or anything else in OpenGL work. @OP, read some tutorials first before asking RTFM-related questions Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel

Medals: 202

« Reply #3 - Posted 2012-04-29 05:34:31 »

As far as OpenGL is concerned, that int is the texture, or at least an opaque "handle" to one anyway.  The storage associated with the handle is something you allocate and manage separately.  This is how all objects in OpenGL work, from textures to buffer objects to shaders.  When you want to work with one of these objects, you "bind" them which sets them as the current object you're working on, and subsequent operations work on the texture or buffer or whatever you have bound.  It's a stateful API, it's a big pain in the ass, but welcome to OpenGL Tongue
Pages: [1]
  ignore  |  Print  

EgonOlsen (59 views)
2018-06-10 19:43:48

EgonOlsen (42 views)
2018-06-10 19:43:44

EgonOlsen (61 views)
2018-06-10 19:43:20

DesertCoockie (240 views)
2018-05-13 18:23:11

nelsongames (142 views)
2018-04-24 18:15:36

nelsongames (141 views)
2018-04-24 18:14:32

ivj94 (883 views)
2018-03-24 14:47:39

ivj94 (144 views)
2018-03-24 14:46:31

ivj94 (795 views)
2018-03-24 14:43:53

Solater (159 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!