Comments (1)
I found out the image is successfully displayed if i use the following function:
static struct nk_image
icon_load(const char *filename)
{
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
unsigned char* data = malloc(4 * 8 * 8 * sizeof(char));
/* define image data: 4 RGBA channels, with 8 x 8 texels: */
for (int i = 0; i < 4 * 8 * 8; i += 4)
{
data[i + 0] = (int)(4 * i) % 256;
data[i + 1] = (int)(4 * i) % 256;
data[i + 2] = (int)(4 * i) % 256;
data[i + 3] = (int)(4 * i) % 256;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (data == NULL) printf("data is NULL!\n");
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
free(data);
return nk_image_id((int)tex);
}
closed as solved :)
from nuklear.
Related Issues (20)
- Errors Reported By Facebook Infer
- Using SDL_GetWindowBordersSize() messes up everything. HOT 3
- Line chart performance: boxes on points make line charts much slower than without HOT 1
- Is it possible to know whether input is captured?
- Creating a nk_image with the sdl_renderer backend HOT 2
- Errors in compiling https://immediate-mode-ui.github.io/Nuklear/doc/#nuklear/example
- Two Issues with Fonts
- Inconsistent grabbing behavior in demos (click and drag property) HOT 8
- Build help with Allegro5 MinGW-64(TDM-Posix-SEH) HOT 2
- Demo headers and nk_ and design choices, oh my! HOT 6
- Backspace does not actually clear a buffer when using nk_edit_string HOT 1
- File Menu HOT 6
- Request: create example for showcasing integration with RGFW HOT 2
- How to make own title bar, without using the operating systems HOT 3
- Group margins/alignment Ubuntu HOT 3
- Demo doesn't include code on how to display images without OpenGL. HOT 1
- After set an opened Combo Box to invisible, no response from the entire window.
- How to do multiple render with one update HOT 2
- Events not working with multiple Nuklear windows
- Add `delta_time_seconds` to each renderer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuklear.